Module:ItemData: Difference between revisionsGive feedback
move comma formatting to invocation so internal pass is a number |
setup error catch in Format, need to setup commas util later |
||
| Line 35: | Line 35: | ||
local function Format(amount) | local function Format(amount) | ||
local formatted = amount | local formatted = amount | ||
if(type(formatted) ~= "number") then return "<span style=\"color:red;\">Cannot format non-number value.</span>" end | |||
return lang:formatNum(tonumber(formatted)) | return lang:formatNum(tonumber(formatted)) | ||
end | end | ||