2016-11-13 14:42:57 +01:00
|
|
|
commands are read line by line
|
|
|
|
|
|
|
|
```[<labelname>:] [<commandname> [<arg1>[,<arg2[…]]]] [; <comment>]```
|
|
|
|
|
2016-12-30 20:55:49 +01:00
|
|
|
arguments can be either variables, labels or immediates,
|
|
|
|
labels are replaced with immediates which have the line numbers of the labels as their values
|
|
|
|
true/false: boolean (immediate)
|
|
|
|
12.6: number (immediate)
|
|
|
|
$hello nwae: string (immediate)
|
2016-11-13 14:42:57 +01:00
|
|
|
nodolla: either a label is called so (immediate) or it's a variable
|
2016-11-13 14:53:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
How to use this mod:
|
|
|
|
|
|
|
|
```
|
|
|
|
local mylog = print
|
|
|
|
|
|
|
|
local parsed_code = pdisc.parse(code_text)
|
|
|
|
|
|
|
|
local function mystart(parsed_code)
|
|
|
|
local thread = pdisc.create_thread(function(thread)
|
|
|
|
thread.flush = function(self)
|
|
|
|
mylog(self.log)
|
|
|
|
self.log = ""
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end, parsed_code)
|
2016-12-28 18:27:41 +01:00
|
|
|
mykeepalive(thread)
|
2016-11-13 14:53:52 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
mystart(parsed_code)
|
|
|
|
|
2016-12-28 18:27:41 +01:00
|
|
|
local function mykeepalive(thread)
|
2016-11-13 14:53:52 +01:00
|
|
|
thread:suscitate()
|
|
|
|
if not thread.stopped then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
thread:try_rebirth()
|
|
|
|
minetest.after(0.1, function()
|
|
|
|
mykeepalive()
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
```
|