diff options
| -rw-r--r-- | compat53/init.lua | 4 | ||||
| -rw-r--r-- | compat53/module.lua | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/compat53/init.lua b/compat53/init.lua index e5f7692..e738091 100644 --- a/compat53/init.lua +++ b/compat53/init.lua | |||
| @@ -9,8 +9,8 @@ local lua_version = _VERSION:sub(-3) | |||
| 9 | if lua_version == "5.1" then | 9 | if lua_version == "5.1" then |
| 10 | 10 | ||
| 11 | -- cache globals | 11 | -- cache globals |
| 12 | local error, pcall, rawset, select, setmetatable, tostring, type, unpack, xpcall = | 12 | local error, pcall, rawset, select, setmetatable, tostring, unpack, xpcall = |
| 13 | error, pcall, rawset, select, setmetatable, tostring, type, unpack, xpcall | 13 | error, pcall, rawset, select, setmetatable, tostring, unpack, xpcall |
| 14 | local coroutine, debug, io, package, string = | 14 | local coroutine, debug, io, package, string = |
| 15 | coroutine, debug, io, package, string | 15 | coroutine, debug, io, package, string |
| 16 | local coroutine_create = coroutine.create | 16 | local coroutine_create = coroutine.create |
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) |
