mirror of
https://github.com/HybridDog/pdisc.git
synced 2024-11-14 14:20:39 +01:00
update readme
M README.md M util/standartbefehlssatz_doc.lua
This commit is contained in:
parent
1c9ed9a133
commit
fd15773adb
107
README.md
107
README.md
|
@ -26,33 +26,86 @@ vn bool variable
|
||||||
|
|
||||||
Instructions:
|
Instructions:
|
||||||
|
|
||||||
mov <v to>, <e from> Copies from into to.
|
mov <v to>, <e from>
|
||||||
getvar <vs varname>[, <ve exists>] Sets varname to the current variable called <varname> if it's set. If exists is passed, it's set to a bool indicating whether the variable was set.
|
Copies from into to.
|
||||||
add <vn to>, <n from> to += from
|
|
||||||
add <vb to>, <b from> to = to and from
|
getvar <vs varname>[, <ve exists>]
|
||||||
add <vs to>, <s from> to = to .. from
|
Sets varname to the current variable called <varname> if it's set. If exists is passed, it's set to a bool indicating whether the variable was set.
|
||||||
mul <vn to>, <n from> to *= from
|
|
||||||
mul <vb to>, <b from> to = to or from
|
add <vn to>, <n from>
|
||||||
mul <vs str>, <n cnt> str = str:rep(from)
|
to += from
|
||||||
neg <vn num> num = -num
|
|
||||||
neg <vb var> var = not var
|
add <vb to>, <b from>
|
||||||
neg <vs str> str = str:rev()
|
to = to and from
|
||||||
inv <vn num> num = 1 / num
|
|
||||||
mod <vn num>, <n dv> num = num % dv
|
add <vs to>, <s from>
|
||||||
jmp <ui p>[, <e c>] If c is not false, the instruction pointer is set to p. To disallow infinite loops, the program is interrupted after changing the ip, the mod should then consider restarting it.
|
to = to .. from
|
||||||
call <ui p> push the ip, then jmp p; used to execute subroutines
|
|
||||||
ret pop something, then jmp there; used to exit subroutines
|
mul <vn to>, <n from>
|
||||||
push <e a>[, <e b>[, <e c>[…]]] put values onto the stack; from left to right
|
to *= from
|
||||||
pop <v a>[, <v b>[, <v c>[…]]] takes values from the stack and sets the passed variables to them; from left to right
|
|
||||||
equal <v a>, <e b> a = a == b
|
mul <vb to>, <b from>
|
||||||
less <vn a>, <n b> a = a < b; after executing, a is a bool
|
to = to or from
|
||||||
less <vs a>, <s b> a = a < b; less also works for strings
|
|
||||||
usleep <n t> aborts the program for at least floor(max(0, t)) ms
|
mul <vs str>, <n cnt>
|
||||||
sleep <n t> executes usleep with t * 1000000 as argument
|
str = str:rep(from)
|
||||||
get_us_time <v to> stores minetest.get_us_time() into to; can be used to measure time differences
|
|
||||||
tostring <ve var> var = tostring(var)
|
neg <vn num>
|
||||||
print <e a>[, <e b>[, <e c>[…]]] adds variables to the log, seperated by \t, \n is added at the end
|
num = -num
|
||||||
flush Output the log, this should vary for every mod.
|
|
||||||
|
neg <vb var>
|
||||||
|
var = not var
|
||||||
|
|
||||||
|
neg <vs str>
|
||||||
|
str = str:rev()
|
||||||
|
|
||||||
|
inv <vn num>
|
||||||
|
num = 1 / num
|
||||||
|
|
||||||
|
mod <vn num>, <n dv>
|
||||||
|
num = num % dv
|
||||||
|
|
||||||
|
jmp <ui p>[, <e c>]
|
||||||
|
If c is not false, the instruction pointer is set to p. To disallow infinite loops, the program is interrupted after changing the ip, the mod should then consider restarting it.
|
||||||
|
|
||||||
|
call <ui p>
|
||||||
|
push the ip, then jmp p; used to execute subroutines
|
||||||
|
|
||||||
|
ret
|
||||||
|
pop something, then jmp there; used to exit subroutines
|
||||||
|
|
||||||
|
push <e a>[, <e b>[, <e c>[…]]]
|
||||||
|
put values onto the stack; from left to right
|
||||||
|
|
||||||
|
pop <v a>[, <v b>[, <v c>[…]]]
|
||||||
|
takes values from the stack and sets the passed variables to them; from left to right
|
||||||
|
|
||||||
|
equal <v a>, <e b>
|
||||||
|
a = a == b
|
||||||
|
|
||||||
|
less <vn a>, <n b>
|
||||||
|
a = a < b; after executing, a is a bool
|
||||||
|
|
||||||
|
less <vs a>, <s b>
|
||||||
|
a = a < b; less also works for strings
|
||||||
|
|
||||||
|
usleep <n t>
|
||||||
|
aborts the program for at least floor(max(0, t)) ms
|
||||||
|
|
||||||
|
sleep <n t>
|
||||||
|
executes usleep with t * 1000000 as argument
|
||||||
|
|
||||||
|
get_us_time <v to>
|
||||||
|
stores minetest.get_us_time() into to; can be used to measure time differences
|
||||||
|
|
||||||
|
tostring <ve var>
|
||||||
|
var = tostring(var)
|
||||||
|
|
||||||
|
print <e a>[, <e b>[, <e c>[…]]]
|
||||||
|
adds variables to the log, seperated by \t, \n is added at the end
|
||||||
|
|
||||||
|
flush
|
||||||
|
Output the log, this should vary for every mod.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,13 +41,14 @@ local instr = {
|
||||||
{"flush", "", "Output the log, this should vary for every mod."},
|
{"flush", "", "Output the log, this should vary for every mod."},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--[[
|
||||||
local mbl = 0
|
local mbl = 0
|
||||||
local mal = 0
|
local mal = 0
|
||||||
for i = 1,#instr do
|
for i = 1,#instr do
|
||||||
local bef = instr[i]
|
local bef = instr[i]
|
||||||
mbl = math.max(#bef[1], mbl)
|
mbl = math.max(#bef[1], mbl)
|
||||||
mal = math.max(#bef[2], mal)
|
mal = math.max(#bef[2], mal)
|
||||||
end
|
end--]]
|
||||||
|
|
||||||
local mtl = 2
|
local mtl = 2
|
||||||
|
|
||||||
|
@ -60,7 +61,8 @@ end
|
||||||
o = o .. "\n\nInstructions:\n\n"
|
o = o .. "\n\nInstructions:\n\n"
|
||||||
for i = 1,#instr do
|
for i = 1,#instr do
|
||||||
i = instr[i]
|
i = instr[i]
|
||||||
o = o .. i[1] .. (" "):rep(mbl - #i[1] + 2) .. i[2] .. (" "):rep(mal - #i[2] + 2) .. i[3] .. "\n"
|
o = o .. i[1] .. " " .. i[2] .. "\n"
|
||||||
|
.. " " .. i[3] .. "\n\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
print(o)
|
print(o)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user