Module:ItemData: Difference between revisionsGive feedback
add comma formatting |
tidy, replace commas with language |
||
| Line 2: | Line 2: | ||
local data = mw.loadJsonData("Data:ItemData.json") | local data = mw.loadJsonData("Data:ItemData.json") | ||
-- returns the | -- returns the table of a specific item | ||
function get_json_item(name) | function get_json_item(name) | ||
for | for _, v in pairs(data) do | ||
if (v["Name"] == name) then | if (v["Name"] == name) then | ||
return v | return v | ||
| Line 13: | Line 13: | ||
-- Adds commas delimiter to the thousands place | -- Adds commas delimiter to the thousands place | ||
local lang = mw.language.getContentLanguage() | |||
local function Format(amount) | |||
function Format(amount) | |||
local formatted = amount | local formatted = amount | ||
return lang:formatNum(tonumber(formatted)) | |||
end | end | ||