Module:WH: Difference between revisions
Jump to navigation
Jump to search
(Created page with "p = {} function p.Skills(frame) local result local frames = mw.getCurrentFrame() -- get the current frame object local num_args = 0 -- initialize the number of arguments to zero for k, v in pairs(frames.args) do num_args = num_args + 1 -- increment the number of arguments for each argument in the frame end local num_skills = math.floor(num_args / 2) local colu =0 --result = "<Br>This is " .. num_skills .. " skills worth </br> out of " ..num_args...") |
No edit summary |
||
Line 12: | Line 12: | ||
local colu =0 | local colu =0 | ||
--result = "<Br>This is " .. num_skills .. " skills worth </br> out of " ..num_args | --result = "<Br>This is " .. num_skills .. " skills worth </br> out of " ..num_args | ||
result = "<table><tr><td class | result = "<table><tr><td class'skills'> ''Skills'' </td><td class='spacer'></td><td class='th-shaded'> ''Level'' </td><td class'skills'> ''Skills'' </td><td class='spacer'></td><td class='th-shaded'> ''Level'' </td><td class'skills'> ''Skills'' </td><td class='spacer'></td><td class='th-shaded' > ''Level'' </td><td class'skills'> ''Skills'' </td><td class='spacer'></td><td class='th-shaded'> ''Level'' </td><td class'skills'> ''Skills'' </td><td class='spacer'></td><td class='th-shaded'> ''Level'' </td></tr><tr>" | ||
for i = 1, num_skills do | for i = 1, num_skills do | ||
colu = colu +1 | colu = colu +1 | ||
Line 18: | Line 18: | ||
local level = frame.args[(i-1)*2+2] | local level = frame.args[(i-1)*2+2] | ||
if colu == 5 then | if colu == 5 then | ||
result = result .. [==[<td class= | result = result .. [==[<td class='skills'>]==] .. name .. [==[</td><td class='spacer'></td><td class='th-shaded'>]==] ..level.. [==[</td></tr><tr>]==] | ||
else | else | ||
result = result .. [==[<td class= | result = result .. [==[<td class='skills'>]==] .. name .. [==[</td><td class='spacer'></td><td class='th-shaded'>]==] ..level.. [==[</td>]==] | ||
end | end | ||
Latest revision as of 15:25, 28 January 2024
Documentation for this module may be created at Module:WH/doc
p = {} function p.Skills(frame) local result local frames = mw.getCurrentFrame() -- get the current frame object local num_args = 0 -- initialize the number of arguments to zero for k, v in pairs(frames.args) do num_args = num_args + 1 -- increment the number of arguments for each argument in the frame end local num_skills = math.floor(num_args / 2) local colu =0 --result = "<Br>This is " .. num_skills .. " skills worth </br> out of " ..num_args result = "<table><tr><td class'skills'> ''Skills'' </td><td class='spacer'></td><td class='th-shaded'> ''Level'' </td><td class'skills'> ''Skills'' </td><td class='spacer'></td><td class='th-shaded'> ''Level'' </td><td class'skills'> ''Skills'' </td><td class='spacer'></td><td class='th-shaded' > ''Level'' </td><td class'skills'> ''Skills'' </td><td class='spacer'></td><td class='th-shaded'> ''Level'' </td><td class'skills'> ''Skills'' </td><td class='spacer'></td><td class='th-shaded'> ''Level'' </td></tr><tr>" for i = 1, num_skills do colu = colu +1 local name = frame.args[(i-1)*2+1] local level = frame.args[(i-1)*2+2] if colu == 5 then result = result .. [==[<td class='skills'>]==] .. name .. [==[</td><td class='spacer'></td><td class='th-shaded'>]==] ..level.. [==[</td></tr><tr>]==] else result = result .. [==[<td class='skills'>]==] .. name .. [==[</td><td class='spacer'></td><td class='th-shaded'>]==] ..level.. [==[</td>]==] end --result = result .. "<p>" .. name.. " " .. level .. " " .. cost .. "</p>" end result=result .. "</table>" return result end return p