1
0
mirror of https://github.com/natnat-mc/moonbuild synced 2026-05-28 06:09:41 +02:00
Files
moonbuild/moonbuild/compat/pcall.moon
T
Codinget c8670ab903 v2
2020-11-07 21:01:26 +01:00

13 lines
300 B
MoonScript

pcall = _G.pcall
unpack = _G.unpack or table.unpack
testfn = (a, b) -> a == b and a == 1 and true or error!
testok, testrst = pcall testfn, 1, 1
unless testok and testrst
realpcall = pcall
pcall = (fn, ...) ->
args = { n: (select '#', ...), ... }
realpcall -> fn unpack args, 1, args.n
pcall