Module:AbilityData: Difference between revisions

From Deadlock Wiki
Jump to navigation Jump to search
Saag (talk | contribs)
initial sandbox
 
Saag (talk | contribs)
No edit summary
Line 17: Line 17:
local item = get_json_item(item_name)
local item = get_json_item(item_name)


return item
return 'test'
end
end


return p
return p

Revision as of 17:36, 13 September 2024

Documentation for this module may be created at Module:AbilityData/doc

local p = {};
local data = mw.loadJsonData("Data:ItemData.json")

-- returns the table of a specific item
function get_json_item(name)
	for i,v in pairs(data) do
		if (v["Name"] == name) then
			return v
		end
	end
	return nil
end

--{{#invoke:ItemData|get_cost|ITEM_NAME}}--
p.test = function(frame)
	local item_name = frame.args[1]
	local item = get_json_item(item_name)

	return 'test'
end

return p