Module:MergeArgs
Module documentation
This documentation is transcluded from Module:MergeArgs/doc. [edit] [history] [purge]
This module is a helper module to be used by other modules; it may not designed to be invoked directly. See RuneScape:Lua/Helper modules for a full list and more information. For a full list of modules using this helper click here
Function | Type | Use |
---|---|---|
merge | Frame | Merges the parent and frame args returning a table containing the arg values instead of an empty table with an attached metatable. Parent args overwrite invoke args allowing invoke args to be used as a "default" value for an argument. |
-- <pre>
local p = {}
function p.merge(frame)
local origArgs = frame.args
local parentArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = mw.text.trim(tostring(v))
if v ~= '' then
args[k] = v
end
end
for k, v in pairs(parentArgs) do
v = mw.text.trim(tostring(v))
if v ~= '' then
args[k] = v
end
end
return args
end
-- </pre>