2014-04-27 23:55:49 +02:00
|
|
|
|
2015-07-05 14:23:28 +02:00
|
|
|
multicraft.log("info", "Initializing Asynchronous environment")
|
2014-04-27 23:55:49 +02:00
|
|
|
|
2015-07-05 14:23:28 +02:00
|
|
|
function multicraft.job_processor(serialized_func, serialized_param)
|
2014-04-27 23:55:49 +02:00
|
|
|
local func = loadstring(serialized_func)
|
2015-07-05 14:23:28 +02:00
|
|
|
local param = multicraft.deserialize(serialized_param)
|
2014-04-27 23:55:49 +02:00
|
|
|
local retval = nil
|
|
|
|
|
|
|
|
if type(func) == "function" then
|
2015-07-05 14:23:28 +02:00
|
|
|
retval = multicraft.serialize(func(param))
|
2014-04-27 23:55:49 +02:00
|
|
|
else
|
2015-07-05 14:23:28 +02:00
|
|
|
multicraft.log("error", "ASYNC WORKER: Unable to deserialize function")
|
2014-04-27 23:55:49 +02:00
|
|
|
end
|
|
|
|
|
2015-07-05 14:23:28 +02:00
|
|
|
return retval or multicraft.serialize(nil)
|
2014-04-27 23:55:49 +02:00
|
|
|
end
|
|
|
|
|