aboutsummaryrefslogtreecommitdiff
path: root/builtin/common/async_event.lua
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/common/async_event.lua')
-rw-r--r--builtin/common/async_event.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/builtin/common/async_event.lua b/builtin/common/async_event.lua
index ef4bf4354..988af79b9 100644
--- a/builtin/common/async_event.lua
+++ b/builtin/common/async_event.lua
@@ -1,6 +1,4 @@
-local core = engine or minetest
-
core.async_jobs = {}
local function handle_job(jobid, serialized_retval)
@@ -10,14 +8,14 @@ local function handle_job(jobid, serialized_retval)
core.async_jobs[jobid] = nil
end
-if engine ~= nil then
- core.async_event_handler = handle_job
-else
- minetest.register_globalstep(function(dtime)
+if core.register_globalstep then
+ core.register_globalstep(function(dtime)
for i, job in ipairs(core.get_finished_jobs()) do
handle_job(job.jobid, job.retval)
end
end)
+else
+ core.async_event_handler = handle_job
end
function core.handle_async(func, parameter, callback)