add hidden column |
fix the massive nuclear explosion I caused of script errors |
||
Line 12: | Line 12: | ||
while true do | while true do | ||
local argI = i * | local argI = i * 4 + 1 | ||
local name = templateFrame.args[argI] | local name = templateFrame.args[argI] | ||
local type = templateFrame.args[argI + 1] | local type = templateFrame.args[argI + 1] |
Latest revision as of 06:05, 17 March 2025
Documentation for this module may be created at Module:ComponentTriggers/doc
-- test in console:
-- =p.main(mw.getCurrentFrame():newChild{title="Template:Table ComponentTriggers",args={"name", "name", "desc"}}:newChild{title="Module:Test",args={}})
-- =p.main(mw.getCurrentFrame():newChild{title="Template:Table ComponentTriggers",args={"name", "name", "{{stub}}"}}:newChild{title="Module:Test",args={}})
-- =p.main(mw.getCurrentFrame():newChild{title="Template:Table ComponentTriggers",args={"name", "name", ""}}:newChild{title="Module:Test",args={}})
local p = {}
function p.main(frame)
local body = ""
local isStub = false
local templateFrame = frame:getParent()
local i = 0
while true do
local argI = i * 4 + 1
local name = templateFrame.args[argI]
local type = templateFrame.args[argI + 1]
local hidden = templateFrame.args[argI + 2]
local description = templateFrame.args[argI + 3]
if name == nil then
break
end
if hidden == "true" then
hidden = "✓"
else
hidden = "X"
end
description = mw.text.trim(description)
if description == "{{stub}}" then isStub = true end
if description == "" then
isStub = true
else
--description = "<translate>" .. description .. "</translate>"
end
body = body.."|-\n"
body = body.."|<code>"..name.."</code>\n"
body = body.."|'''"..type.."'''\n"
body = body.."|"..hidden.."\n"
body = body.."|"..description.."\n"
i = i + 1
end
if isStub then body = body.."[[Category:ComponentStubs]]" end
return body
end
return p