debug(lua): добавил __log в drain_handler
Чтобы увидеть запускается ли handler из очереди и нет ли pcall error. Сейчас [shim fireTargetEvent] показывает connections=1 но нигде нет выхлопа от Touched handler — где-то теряется.
This commit is contained in:
parent
0980ec4a5f
commit
4835cb59c2
@ -1744,20 +1744,20 @@ export function registerRobloxShim(lua, opts) {
|
||||
function __rbxl_drain_handler(fn, a1, a2, a3, a4)
|
||||
__rbxl_next_handler_id = __rbxl_next_handler_id + 1
|
||||
local handlerId = "handler_" .. __rbxl_next_handler_id
|
||||
-- Оборачиваем call в pcall чтобы поглотить return value handler'а
|
||||
-- (RayGun возвращает :connect(...) объект как последнее выражение,
|
||||
-- что приводит к wasmoon promise-detection crash). pcall возвращает
|
||||
-- (ok, ret1, ret2, ...) — мы их не используем.
|
||||
__log("warn", "[drain] starting handler " .. handlerId)
|
||||
local co = coroutine.create(function()
|
||||
-- Тот же watchdog что и в _startSingleScript.
|
||||
debug.sethook(function()
|
||||
coroutine.yield(0.016)
|
||||
end, "", 20000)
|
||||
pcall(fn, a1, a2, a3, a4)
|
||||
local ok, err = pcall(fn, a1, a2, a3, a4)
|
||||
if not ok then
|
||||
__log("error", "[drain handler error] " .. tostring(err))
|
||||
end
|
||||
end)
|
||||
__rbxl_register_coroutine(handlerId, co)
|
||||
local ok, ret = coroutine.resume(co)
|
||||
if not ok then
|
||||
__log("error", "[drain resume error] " .. tostring(ret))
|
||||
__rbxl_send_error(handlerId, tostring(ret))
|
||||
__rbxl_unregister_coroutine(handlerId)
|
||||
elseif type(ret) == 'number' then
|
||||
@ -1765,7 +1765,6 @@ export function registerRobloxShim(lua, opts) {
|
||||
elseif coroutine.status(co) == 'dead' then
|
||||
__rbxl_unregister_coroutine(handlerId)
|
||||
end
|
||||
-- Явно ничего не возвращаем чтобы wasmoon не оборачивал nil
|
||||
end
|
||||
`);
|
||||
// Кешируем ссылку на Lua-функцию запуска handler'а
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user