нет описания правки
Нет описания правки Метка: отменено |
Нет описания правки Метка: отменено |
||
local xtable = require('Module:Table')
local getArgs -- Lazy load require('Module:Arguments').getArgs
local m_cargo -- Lazy load require('Module:Cargo')
util.misc = {}
function util.misc.invoker_factory(func, options)
-- Returns a function that can be called directly or with #invoke.
return function (frame)
frame = frame or {}
local args
if type(frame.args) == 'table' then
-- Called via #invoke, so use getArgs().
getArgs = getArgs or require('Module:Arguments').getArgs
args = getArgs(frame, options)
else
-- Called from another module or from the debug console, so assume args
-- are passed in directly.
args = frame
end
return func(args)
end
end
function util.misc.is_frame(frame)
-- the type of the frame is a table containing the functions, so check whether some of these exist
|