Module:LuaCall: Difference between revisions
From Test Wiki
Content deleted Content added
Trying to execute one arbitrary Lua built-in library function from a template. Inspired by the guy trying to do string.rep with a module |
debuglog |
||
| Line 3: | Line 3: | ||
function p.main(frame) |
function p.main(frame) |
||
local parent=frame.getParent(frame) or {} |
local parent=frame.getParent(frame) or {} |
||
local debuglog="" |
|||
for k,v in pairs(parent.args or {}) do |
for k,v in pairs(parent.args or {}) do |
||
_G[k]=v -- transfer every parameter directly to the global variable table |
_G[k]=v -- transfer every parameter directly to the global variable table |
||
debuglog=debuglog..k.."="..v.."\n" |
|||
end |
end |
||
for k,v in pairs(frame.args or {}) do |
for k,v in pairs(frame.args or {}) do |
||
| Line 24: | Line 26: | ||
end |
end |
||
end |
end |
||
if not reserved_function then return debuglog end |
|||
return _G[reserved_function](unpack(reserved_contents or {})) |
return _G[reserved_function](unpack(reserved_contents or {})) |
||
end |
end |
||