Module:Armor

local p = {}

function output_many(num, val) iter = 0 out = '' while iter ~= num do       out = out .. val iter = iter + 1 end return out end

p.armor = function(f) local args = f.args or f   if f == mw.getCurrentFrame and args[1] == nil then args = f:getParent.args else f = mw.getCurrentFrame end args = require(Module:ProcessArgs).norm(args) local rating = args[1] or 0 local text = args["text"] local size = args["size"] or "9" local empty if text ~= nil then empty = 0 else empty = math.ceil(((args["max"] or 20) - rating) / 2) end local ret = output_many(math.floor(rating / 2), "") .. output_many(rating % 2, "") .. output_many(empty, "") if text ~= nil then return rating .. " (" .. ret .. ")" else return ret end end

return p