blob: 1bbf4a3b67b804fe6e9ba952423eda0f981924fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-- When using LuaJIT try to retain backwards compatibility (Lua 5.1).
-- LuaJIT is compiled with LUAJIT_ENABLE_LUA52COMPAT for some Lua 5.2 features.
-- In Lua 5.1, `xpcall` did not accept function arguments.
local xpcall51 = xpcall
function xpcall(f, error, ...)
local args = {...}
return xpcall51(function() return f(unpack(args)) end, error)
end
-- In Lua 5.1, `load` did not take mode and environment parameters.
local load51 = load
function load(ld, source, mode, env)
local f, err = load51(ld, source)
if f and env then return setfenv(f, env) end
return f, err
end
|