diff options
Diffstat (limited to 'compat53/module.lua')
| -rw-r--r-- | compat53/module.lua | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/compat53/module.lua b/compat53/module.lua index 30b42ee..c69c131 100644 --- a/compat53/module.lua +++ b/compat53/module.lua | |||
| @@ -7,8 +7,8 @@ local M = _G | |||
| 7 | if lua_version < "5.3" then | 7 | if lua_version < "5.3" then |
| 8 | 8 | ||
| 9 | -- cache globals in upvalues | 9 | -- cache globals in upvalues |
| 10 | local error, getmetatable, ipairs, pairs, pcall, require, select, setmetatable, type = | 10 | local error, ipairs, pairs, pcall, require, select, setmetatable, type = |
| 11 | error, getmetatable, ipairs, pairs, pcall, require, select, setmetatable, type | 11 | error, ipairs, pairs, pcall, require, select, setmetatable, type |
| 12 | local debug, math, package, string, table = | 12 | local debug, math, package, string, table = |
| 13 | debug, math, package, string, table | 13 | debug, math, package, string, table |
| 14 | 14 | ||
| @@ -352,8 +352,8 @@ if lua_version < "5.3" then | |||
| 352 | #setmetatable({}, { __len = function() return 1 end }) == 1 | 352 | #setmetatable({}, { __len = function() return 1 end }) == 1 |
| 353 | 353 | ||
| 354 | -- cache globals in upvalues | 354 | -- cache globals in upvalues |
| 355 | local load, loadfile, loadstring, setfenv, tostring, unpack, xpcall = | 355 | local load, loadfile, loadstring, setfenv, unpack, xpcall = |
| 356 | load, loadfile, loadstring, setfenv, tostring, unpack, xpcall | 356 | load, loadfile, loadstring, setfenv, unpack, xpcall |
| 357 | local coroutine, io, os = coroutine, io, os | 357 | local coroutine, io, os = coroutine, io, os |
| 358 | local coroutine_create = coroutine.create | 358 | local coroutine_create = coroutine.create |
| 359 | local coroutine_resume = coroutine.resume | 359 | local coroutine_resume = coroutine.resume |
| @@ -529,6 +529,14 @@ if lua_version < "5.3" then | |||
| 529 | end | 529 | end |
| 530 | 530 | ||
| 531 | 531 | ||
| 532 | if not is_luajit then | ||
| 533 | function M.xpall(f, msgh, ...) | ||
| 534 | local args, n = { ... }, select('#', ...) | ||
| 535 | return xpcall(function() return f(unpack(args, 1, n)) end, msgh) | ||
| 536 | end | ||
| 537 | end | ||
| 538 | |||
| 539 | |||
| 532 | if not is_luajit52 then | 540 | if not is_luajit52 then |
| 533 | function M.os.execute(cmd) | 541 | function M.os.execute(cmd) |
| 534 | local code = os_execute(cmd) | 542 | local code = os_execute(cmd) |
