Better Lua version compatibility.
This commit is contained in:
parent
e564ec311a
commit
d5914f2a9e
|
@ -22,7 +22,7 @@ local loadtarget
|
||||||
|
|
||||||
-- Compatibility polyfill for load
|
-- Compatibility polyfill for load
|
||||||
local function loadf(text, source, mode, env)
|
local function loadf(text, source, mode, env)
|
||||||
if rawget(_G, "loadstring") then
|
if rawget(_G, "loadstring") and rawget(_G, "setfenv") then
|
||||||
local chunk, e = loadstring(text, "@"..source)
|
local chunk, e = loadstring(text, "@"..source)
|
||||||
if chunk then
|
if chunk then
|
||||||
setfenv(chunk, env)
|
setfenv(chunk, env)
|
||||||
|
|
Loading…
Reference in a new issue