Module:Decodedata-Weapons
Jump to navigation
Jump to search
The above documentation is transcluded from Module:Decodedata-Weapons/doc. (edit | history)
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