diff --git a/README.md b/README.md index 6bf13ff..15aea77 100644 --- a/README.md +++ b/README.md @@ -26,33 +26,86 @@ vn bool variable Instructions: -mov , Copies from into to. -getvar [, ] Sets varname to the current variable called if it's set. If exists is passed, it's set to a bool indicating whether the variable was set. -add , to += from -add , to = to and from -add , to = to .. from -mul , to *= from -mul , to = to or from -mul , str = str:rep(from) -neg num = -num -neg var = not var -neg str = str:rev() -inv num = 1 / num -mod , num = num % dv -jmp [, ] 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 push the ip, then jmp p; used to execute subroutines -ret pop something, then jmp there; used to exit subroutines -push [, [, […]]] put values onto the stack; from left to right -pop [, [, […]]] takes values from the stack and sets the passed variables to them; from left to right -equal , a = a == b -less , a = a < b; after executing, a is a bool -less , a = a < b; less also works for strings -usleep aborts the program for at least floor(max(0, t)) ms -sleep executes usleep with t * 1000000 as argument -get_us_time stores minetest.get_us_time() into to; can be used to measure time differences -tostring var = tostring(var) -print [, [, […]]] adds variables to the log, seperated by \t, \n is added at the end -flush Output the log, this should vary for every mod. +mov , + Copies from into to. + +getvar [, ] + Sets varname to the current variable called if it's set. If exists is passed, it's set to a bool indicating whether the variable was set. + +add , + to += from + +add , + to = to and from + +add , + to = to .. from + +mul , + to *= from + +mul , + to = to or from + +mul , + str = str:rep(from) + +neg + num = -num + +neg + var = not var + +neg + str = str:rev() + +inv + num = 1 / num + +mod , + num = num % dv + +jmp [, ] + 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 + push the ip, then jmp p; used to execute subroutines + +ret + pop something, then jmp there; used to exit subroutines + +push [, [, […]]] + put values onto the stack; from left to right + +pop [, [, […]]] + takes values from the stack and sets the passed variables to them; from left to right + +equal , + a = a == b + +less , + a = a < b; after executing, a is a bool + +less , + a = a < b; less also works for strings + +usleep + aborts the program for at least floor(max(0, t)) ms + +sleep + executes usleep with t * 1000000 as argument + +get_us_time + stores minetest.get_us_time() into to; can be used to measure time differences + +tostring + var = tostring(var) + +print [, [, […]]] + adds variables to the log, seperated by \t, \n is added at the end + +flush + Output the log, this should vary for every mod. ``` diff --git a/util/standartbefehlssatz_doc.lua b/util/standartbefehlssatz_doc.lua index 033a52f..fb388f2 100644 --- a/util/standartbefehlssatz_doc.lua +++ b/util/standartbefehlssatz_doc.lua @@ -41,13 +41,14 @@ local instr = { {"flush", "", "Output the log, this should vary for every mod."}, } +--[[ local mbl = 0 local mal = 0 for i = 1,#instr do local bef = instr[i] mbl = math.max(#bef[1], mbl) mal = math.max(#bef[2], mal) -end +end--]] local mtl = 2 @@ -60,7 +61,8 @@ end o = o .. "\n\nInstructions:\n\n" for i = 1,#instr do 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 print(o)