mirror of https://github.com/minetest/minetest.git
minor
This commit is contained in:
parent
cca26c0eb2
commit
96dfd5cc0f
|
@ -34,7 +34,7 @@ if core.async_job_methods then
|
|||
|
||||
local dummy = function() end
|
||||
function core.async_job_methods:cancel()
|
||||
return self:get_id() == self:replace(dummy, dummy)
|
||||
return self:get_id() == self:replace(dummy, dummy):get_id()
|
||||
end
|
||||
|
||||
core.async_job_methods = nil
|
||||
|
|
|
@ -212,7 +212,6 @@ local function test_async_job_replacement(cb)
|
|||
local job = core.handle_async(function(x)
|
||||
return x
|
||||
end, function(ret)
|
||||
print(ret)
|
||||
cb("Replaced async callback still run")
|
||||
end, 1)
|
||||
local newjob = job:replace(function(x)
|
||||
|
@ -223,7 +222,7 @@ local function test_async_job_replacement(cb)
|
|||
end
|
||||
end, 2)
|
||||
if job:get_id() ~= newjob:get_id() then
|
||||
cb("core.replace_async sanity check failed")
|
||||
cb("AsyncJob:replace sanity check failed")
|
||||
end
|
||||
|
||||
job = core.handle_async(function(x)
|
||||
|
@ -243,7 +242,7 @@ local function test_async_job_replacement(cb)
|
|||
return cb("Wrong async value passed to old handler")
|
||||
end
|
||||
|
||||
newjob = job:replace(id, function(x)
|
||||
newjob = job:replace(function(x)
|
||||
return -x
|
||||
end, function(new_ret)
|
||||
if new_ret ~= -2 then
|
||||
|
@ -252,10 +251,10 @@ local function test_async_job_replacement(cb)
|
|||
cb()
|
||||
end, 2)
|
||||
if job:get_id() == newjob:get_id() then
|
||||
cb("core.replace_async replaced a completed job")
|
||||
cb("AsyncJob:replace replaced a completed job")
|
||||
end
|
||||
if id:cancel() then
|
||||
cb("core.relpace_async canceled a completed job")
|
||||
if job:cancel() then
|
||||
cb("AsyncJob:replace canceled a completed job")
|
||||
end
|
||||
end, 1)
|
||||
end
|
||||
|
|
|
@ -77,7 +77,7 @@ void LuaAsyncJob::Register(lua_State *L)
|
|||
lua_getglobal(L, "core");
|
||||
luaL_getmetatable(L, className);
|
||||
lua_getfield(L, -1, "__index");
|
||||
lua_setfield(L, -2, "async_job_methods");
|
||||
lua_setfield(L, -3, "async_job_methods");
|
||||
}
|
||||
|
||||
const char LuaAsyncJob::className[] = "AsyncJob";
|
||||
|
|
Loading…
Reference in New Issue