Module:Grid/Crafting Square Numbers

local p = {}

local g = require("Module:Common") local s = require("Module:Sprite")

function p.makeCraftingNumbers(amount, link) local pos = {11, 11, 11} if amount > 1 then if amount > 99 then pos[1] = math.floor(amount / 100) amount = math.mod(amount, 100) pos[2] = math.floor(amount / 10) amount = math.mod(amount, 10) elseif amount > 9 then pos[2] = math.floor(amount / 10) amount = math.mod(amount, 10) end pos[3] = amount elseif amount == 0 then pos[3] = 0 end -- Value for 0 is at position 10 in the sprite sheet for idx = 1, 3, 1 do		if pos[idx] == 0 then pos[idx] = 10 end end local output = " " .. s.makeSprite("GridNumbersCSS.png", pos[1] - 1, 16, 64, link) .. " "	output = output .. "" .. s.makeSprite("GridNumbersCSS.png", pos[2] - 1, 16, 64, link) .. " "	output = output .. "" .. s.makeSprite("GridNumbersCSS.png", pos[3] - 1, 16, 64, link) .. " "

return output end

function p.main(frame) return p.makeCraftingNumbers(tonumber(frame.args[1] or 1), frame.args[2] or '') end

return p