Module:LuaCall: Difference between revisions
From Test Wiki
Content deleted Content added
force debug option |
Implementing suggested fix (no, it doesn't savvy dots!) |
||
| Line 5: | Line 5: | ||
local debuglog="Parent: </nowiki><br /><nowiki>" |
local debuglog="Parent: </nowiki><br /><nowiki>" |
||
local reserved_value={} |
local reserved_value={} |
||
| ⚫ | |||
local reserved_function,reserved_contents |
local reserved_function,reserved_contents |
||
for k,v in pairs(parent.args or {}) do |
for k,v in pairs(parent.args or {}) do |
||
| Line 20: | Line 19: | ||
--- this will not stop us from trying to implement one single lousy function call |
--- this will not stop us from trying to implement one single lousy function call |
||
if _G[1] then |
if _G[1] then |
||
reserved_function,reserved_contents=mw.ustring.match(_G[1],"^ |
reserved_function,reserved_contents=mw.ustring.match(_G[1],"^%s*(%a[^%s%(]*)%(([^%)]*)%)%s*$") |
||
debuglog=debuglog.."Function is:" .. reserved_function .. "</nowiki><br /><nowiki>Contents are:"..reserved_contents.."</nowiki><br /><nowiki>" |
debuglog=debuglog.."Function is:" .. reserved_function .. "</nowiki><br /><nowiki>Contents are:"..reserved_contents.."</nowiki><br /><nowiki>" |
||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
end |
end |
||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
local reserved_arraypart=_G |
|||
| ⚫ | |||
reserved_call=reserved_call[mw.ustring.match(reserved_function,"^(%a[^%.]*)%.") or reserved_arraypart] |
|||
local reserved_function=mw.ustring.match(reserved_function,"^%a[^%.]*%.(.*)$") |
|||
debuglog=debuglog.."->"..reserved_function.."</nowiki><br /><nowiki>" |
|||
end |
|||
| ⚫ | |||
if reserved_debug or not reserved_function then return frame.preprocess(frame,"<nowiki>"..debuglog.."</nowiki>") end |
if reserved_debug or not reserved_function then return frame.preprocess(frame,"<nowiki>"..debuglog.."</nowiki>") end |
||
| ⚫ | |||
return _G[reserved_function](unpack(reserved_contents or {})) |
return _G[reserved_function](unpack(reserved_contents or {})) |
||
end |
end |
||