Module:Sandbox/Nux
Appearance
| This module is rated as pre-alpha. It is incomplete and may or may not be in active development. Do not use it in article namespace pages. A module remains in pre-alpha until its developer, or another editor who adopts it if it is abandoned for some time, considers the basic structure complete. |
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