Module:Decodedata-Weapons

From Helldivers Wiki
Jump to navigation Jump to search
Template-info.svg Documentation

Data can be found at Module:Decodedata-Weapons/data.json

Usage

local title = mw.title.new('Module:Decodedata-Weapons/data.json')
local content = title:getContent()
local json = mw.text.jsonDecode(content)
-- the json is an array of objects, so restructure it to be a key-value table.
local data = {}
for _, value in pairs(json) do
	local key = value['fullname']
	value['fullname'] = nil -- removed from value to reduce the table size.
	data[key] = value
end
-- Data is now a key-value table.
-- Traverse with pairs, or access directly via key.
return data