diff --git a/README.md b/README.md index c6cc9a2..dbaf8aa 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,37 @@ true/false: boolean (immediate) 12.6: number (immediate) $hello nwae: string (immediate) nodolla: either a label is called so (immediate) or it's a variable + + + +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) + mykeepalive() +end + +mystart(parsed_code) + +local function mykeepalive() + thread:suscitate() + if not thread.stopped then + return + end + thread:try_rebirth() + minetest.after(0.1, function() + mykeepalive() + end) +end +``` diff --git a/faden.lua b/faden.lua index be241eb..4ab0fe8 100644 --- a/faden.lua +++ b/faden.lua @@ -54,7 +54,7 @@ local function programm_ausfuhren(faden) return not faden.stopped and programm_ausfuhren(faden) end -return function (faden_manip, parsed) +return function(faden_manip, parsed) local faden = { log = "", ip = 1,