Module:ItemTables: Difference between revisions

remove debugging
moving function out to be accessible for other modules
Line 11: Line 11:
return nil
return nil
end
end


-- Adds commas delimiter to the thousands place
-- Adds commas delimiter to the thousands place
Line 56: Line 55:
end
end


 
local function get_cost(item_name)
--{{#invoke:ItemData|get_cost|ITEM_NAME}}--
p.get_cost = function(frame)
local item_name = frame.args[1]
local item = get_json_item(item_name)
local item = get_json_item(item_name)
if(item == nil) then return "<span style=\"color:red;\">Item Not Found.</span>" end
if(item == nil) then return "<span style=\"color:red;\">Item Not Found.</span>" end
Line 74: Line 70:


return Format(cost)
return Format(cost)
end
--{{#invoke:ItemData|get_cost|ITEM_NAME}}--
function p.get_cost(frame)
local item_name = frame.args[1]
return get_cost(item_name)
end
end


Line 132: Line 135:
tableData
tableData
:tag('td'):wikitext(display):done()
:tag('td'):wikitext(display):done()
:tag('td'):wikitext(statName["Cost"]):done()
:tag('td'):wikitext(get_cost(statName["Name"])):done()
table.insert(requirements, tableData)
table.insert(requirements, tableData)