Module:AttributeData

From Deadlock Wiki
Revision as of 02:10, 13 September 2024 by Sur (talk | contribs) (initial, get_attr_category)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

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

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

--{{#invoke:AttributeData|get_attr_category|ATTR_NAME}}--
p.get_attr_category = function(frame)
	local attr_name = frame.args[1]
	
	local attr = data[attr_name]
	if(attr == nil) then return "Attribute Not Found" end

	return attr['UICategory']
end

return p