Skip to content

Commit 732898e

Browse files
committed
Avoid packing arguments in a table.
The implementation of coxpcall is based on coroutine.resume which, in contrast to xpcall, can handle extra arguments since the beginning. So, packing the arguments in a table is unnecessary and wasteful.
1 parent 66f0ee6 commit 732898e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/coxpcall.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ function coxpcall(f, err, ...)
7676
else
7777
local res, co = oldpcall(coroutine.create, f)
7878
if not res then
79-
local params = pack(...)
80-
local newf = function() return f(unpack(params, 1, params.n)) end
79+
local newf = function(...) return f(...) end
8180
co = coroutine.create(newf)
8281
end
8382
coromap[co] = current

0 commit comments

Comments
 (0)