mirror of
https://github.com/minetest/minetest.git
synced 2024-11-14 03:33:44 +01:00
20 lines
541 B
Lua
20 lines
541 B
Lua
engine.log("info","Initializing Asynchronous environment")
|
|
|
|
dofile(SCRIPTDIR .. DIR_DELIM .. "misc_helpers.lua")
|
|
|
|
function engine.job_processor(serialized_function, serialized_data)
|
|
|
|
local fct = marshal.decode(serialized_function)
|
|
local params = marshal.decode(serialized_data)
|
|
local retval = marshal.encode(nil)
|
|
|
|
if fct ~= nil and type(fct) == "function" then
|
|
local result = fct(params)
|
|
retval = marshal.encode(result)
|
|
else
|
|
engine.log("error","ASYNC WORKER: unable to deserialize function")
|
|
end
|
|
|
|
return retval,retval:len()
|
|
end
|