From e8d32711950e762c65d33f92150b8366b2b82005 Mon Sep 17 00:00:00 2001 From: kevinhwang91 Date: Tue, 27 Feb 2024 08:21:04 +0800 Subject: [PATCH] fix(compat): simplify `_xpcall` function --- lua/promise-async/compat.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lua/promise-async/compat.lua b/lua/promise-async/compat.lua index 80f06d5..01c9d54 100644 --- a/lua/promise-async/compat.lua +++ b/lua/promise-async/compat.lua @@ -64,10 +64,7 @@ if M.is51() then M.xpcall = function(f, msgh, ...) local thread = coroutine.running() if not thread then - local args, n = {...}, select('#', ...) - return _xpcall(function() - return f(unpack(args, 1, n)) - end, msgh) + return _xpcall(f, msgh, ...) end return xpcallCatch(msgh, doPcall(thread, f, ...)) end