Module:LuaCall: Difference between revisions

From Test Wiki
Content deleted Content added
mNo edit summary
I think this is the bug - local scoping?
Line 4: Line 4:
local parent=frame.getParent(frame) or {}
local parent=frame.getParent(frame) or {}
local debuglog="Parent: </nowiki><br /><nowiki>"
local debuglog="Parent: </nowiki><br /><nowiki>"
local reserved_value={}
local reserved_counter=0
local reserved_function,reserved_contents
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
Line 17: Line 20:
--- 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
local reserved_function,reserved_contents=mw.ustring.match(_G[1],"^(%s*%a[^%s%(]*)%(([^%)]*)%)%s*$")
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>"
local reserved_value={}
local reserved_counter=0
if reserved_contents then
if reserved_contents then
repeat
repeat