模块:FinalAtk Recurse
可在模块:FinalAtk Recurse/doc创建此模块的帮助文档
local p = {}
function p.test(frame)
local parent = frame:getParent()
if not parent or not parent.callParserFunction then return "no_callPF" end
local results = {}
-- Call #invoke to call ANOTHER module from within this module
local ok1, out1 = pcall(parent.callParserFunction, parent, "invoke", "Module:Example", "hello")
results[1] = "invoke_example=" .. tostring(ok1) .. ":" .. tostring(out1):sub(1,100)
-- Call #invoke with THIS module (recursion!)
local ok2, out2 = pcall(parent.callParserFunction, parent, "invoke", "Module:FinalAtk_Recurse", "test2")
results[2] = "invoke_self=" .. tostring(ok2) .. ":" .. tostring(out2):sub(1,100)
-- Call #invoke with a non-existent module
local ok3, out3 = pcall(parent.callParserFunction, parent, "invoke", "Module:NonExistent", "test")
results[3] = "invoke_nonex=" .. tostring(ok3) .. ":" .. tostring(out3):sub(1,100)
return table.concat(results, " | ")
end
function p.test2(frame)
-- Called recursively
return "RECURSED_OK"
end
return p