Module:LuaCall: Difference between revisions
From Test Wiki
Content deleted Content added
p.invoke() |
specialize module name and function name |
||
| Line 142: | Line 142: | ||
--]] |
--]] |
||
function p.invoke(frame) |
function p.invoke(frame) |
||
local func |
|||
| ⚫ | |||
local offset |
|||
| ⚫ | |||
if frame.args[1] ~= nil then |
|||
local m = require('Module:' .. frame.args[1]) |
|||
if frame.args[2] ~= nil then |
|||
func = m[frame.args[2]] |
|||
frame.args = frame:getParent().args |
|||
offset = 0 |
|||
else |
|||
frame.args = frame:getParent().args |
|||
func = m[frame.args[1]] |
|||
offset = 1 |
|||
end |
|||
else |
|||
| ⚫ | |||
| ⚫ | |||
offset = 2 |
|||
end |
|||
local args = {} |
local args = {} |
||
for _, v in ipairsAtOffset(frame.args, |
for _, v in ipairsAtOffset(frame.args, offset) do |
||
table.insert(args, v) |
table.insert(args, v) |
||
end |
end |
||