Module:Sandbox/Nux
Appearance
![]() | This module is rated as pre-alpha. It is unfinished, and may or may not be in active development. It should not be used from article namespace pages. Modules remain pre-alpha until the original editor (or someone who takes one over if it is abandoned for some time) is satisfied with the basic structure. |
Usage
Can be inv9oked without params in a template and will still work: {{#invoke:Sandbox/Nux|parseEnumParams}}
local p = {}
function p.parseEnumParams(frame)
local args = frame:getParent().args
local result = {}
local i = 1
while args["label" .. i] and args["value" .. i] and args["color" .. i] do
table.insert(result, {
label = mw.ustring.gsub(args["label" .. i] or "", "vv", "$v"),
value = tonumber(args["value" .. i]) or 0,
color = args["color" .. i] or ""
})
i = i + 1
end
mw.logObject(result)
return mw.text.jsonEncode(result) -- Returning JSON for debugging purposes
end
return p