Module:Eval
From Jules RNG Wiki
More actions
Documentation for this module may be created at Module:Eval/doc
local p = {}
function p.run(frame)
-- Get the code passed as the first parameter
local code = frame.args[1] or ""
-- Load the string as a Lua chunk
-- 'load' is preferred in newer Lua versions, 'loadstring' in 5.1
local func, err = loadstring(code)
if not func then
return "Lua Error: " .. err
end
-- Execute it
return func()
end
return p