aboutsummaryrefslogtreecommitdiff
path: root/builtin/async
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-04-27 17:55:49 -0400
committerShadowNinja <shadowninja@minetest.net>2014-05-07 17:14:23 -0400
commit1cd512913e4d4ad1fb43d4b6e3d7971bb6c67528 (patch)
tree8c1e2c708f567656684e89faee4f7c8e6c5ec673 /builtin/async
parentfef2729fd0945601e6772780514ee55fec35b068 (diff)
downloadminetest-1cd512913e4d4ad1fb43d4b6e3d7971bb6c67528.tar.gz
minetest-1cd512913e4d4ad1fb43d4b6e3d7971bb6c67528.tar.bz2
minetest-1cd512913e4d4ad1fb43d4b6e3d7971bb6c67528.zip
Organize builtin into subdirectories
Diffstat (limited to 'builtin/async')
-rw-r--r--builtin/async/init.lua18
1 files changed, 18 insertions, 0 deletions
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
+