1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-11-05 17:05:05 -05:00
minetest/builtin/async/init.lua

18 lines
432 B
Lua
Raw Normal View History

2014-04-27 17:55:49 -04:00
2014-04-27 21:02:48 -04:00
core.log("info", "Initializing Asynchronous environment")
2014-04-27 17:55:49 -04:00
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