fix(lua): preserve argument lists which are not lists

This commit is contained in:
Björn Linse
2021-08-07 21:17:45 +02:00
parent 636ecd0c3b
commit 6896d22b63
3 changed files with 30 additions and 2 deletions

View File

@ -27,5 +27,14 @@ function F.nil_wrap(fn)
end
end
--- like {...} except preserve the lenght explicitly
function F.pack_len(...)
return {n=select('#', ...), ...}
end
--- like unpack() but use the length set by F.pack_len if present
function F.unpack_len(t)
return unpack(t, 1, t.n)
end
return F