Module:WH

From Empire of Dragons
Jump to navigation Jump to search

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