From 1cd512913e4d4ad1fb43d4b6e3d7971bb6c67528 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Sun, 27 Apr 2014 17:55:49 -0400 Subject: Organize builtin into subdirectories --- builtin/async/init.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 builtin/async/init.lua (limited to 'builtin/async') diff --git a/builtin/async/init.lua b/builtin/async/init.lua new file mode 100644 index 000000000..79b1a0a6c --- /dev/null +++ b/builtin/async/init.lua @@ -0,0 +1,18 @@ +engine.log("info", "Initializing Asynchronous environment") + +local core = engine or minetest + +function core.job_processor(serialized_func, serialized_param) + local func = loadstring(serialized_func) + local param = core.deserialize(serialized_param) + local retval = nil + + if type(func) == "function" then + retval = core.serialize(func(param)) + else + core.log("error", "ASYNC WORKER: Unable to deserialize function") + end + + return retval or core.serialize(nil) +end + -- cgit v1.2.3