aboutsummaryrefslogtreecommitdiff
path: root/builtin/async/init.lua
blob: 79b1a0a6c241968c3b0ff7fa0334af4790dec87c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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