Module:SMART attributes: Difference between revisions
From Australian Enthusiasts Wiki
Fix names and rm hex translator that's now deleted |
Add package |
||
| Line 1: | Line 1: | ||
-- Implements Template:SMART attributes. | -- Implements Template:SMART attributes. | ||
local p = {} | |||
function makeSmartAttrTable() | function p.makeSmartAttrTable() | ||
frame = mw.getCurrentFrame() | frame = mw.getCurrentFrame() | ||
-- Start table | -- Start table | ||
| Line 30: | Line 31: | ||
end | end | ||
return | return p | ||
Revision as of 21:29, 3 March 2021
Documentation for this module may be created at Module:SMART attributes/doc
-- Implements Template:SMART attributes.
local p = {}
function p.makeSmartAttrTable()
frame = mw.getCurrentFrame()
-- Start table
table = ""
table = table .. "!width=17%|'''ID'''"
table = table .. "!width=17%|'''Name'''"
table = table .. "{|cellspacing=\"0\" cellpadding=\"4\" border=\"1\" style=\"margin: 0 0 1em 1em; border: 1px #171717 solid; border-collapse: collapse; font-size: 90%;\" class=\"wikitable\""
for i=1, 254, 1 do
argName = ""
if (frame.args[string.format("%x", i)] ~= nil) then
argName = string.format("%x", i)
elseif (frame.args[i] ~= nil) then
argName = i
elseif (frame.args["0x" .. string.format("%x", i)] ~= nil) then
argName = "0x" .. string.format("%x", i)
end
if (argName ~= "") then
table = table .. "|-"
table = table .. "|" .. "0x" .. string.format("%x", i) .. tostring(i)
table = table .. "|" .. frame.args(argName)
end
end
table = table .. "|}"
return table
end
return p