We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8acc92c commit 01b53e1Copy full SHA for 01b53e1
1 file changed
src/cli.lua
@@ -46,17 +46,23 @@ local function lines_from(file)
46
end
47
48
local function load_chunk(content, chunkName, environment)
49
- if _VERSION == "Lua 5.1" then
+ if type(loadstring) == "function" then
50
local func, err = loadstring(content, chunkName)
51
if not func then
52
return nil, err
53
54
- if environment then
+ if environment and type(setfenv) == "function" then
55
setfenv(func, environment)
56
+ elseif environment and type(load) == "function" then
57
+ return load(content, chunkName, "t", environment)
58
59
return func
60
61
62
+ if type(load) ~= "function" then
63
+ return nil, "No load function available"
64
+ end
65
+
66
return load(content, chunkName, "t", environment)
67
68
0 commit comments