re-implement

This commit is contained in:
zeng-git 2025-01-09 00:01:22 +08:00
parent 9cf2fbe9fd
commit a4d2c21a73

View File

@ -52,9 +52,9 @@ end
_coroutine.wrap = function(f) _coroutine.wrap = function(f)
local thread = coroutine.create(f) local thread = coroutine.create(f)
return function(...) return function(...)
local result, reason = coroutine.resume(thread, ...) local result_pack = table.pack(coroutine.resume(thread, ...))
assert(result, reason) if not result_pack[1] then error(result_pack[2], 2) end
return reason return table.unpack(result_pack, 2, result_pack.n)
end end
end end