Ways of Darkness
Ways of Darkness
avatar Log in

Module:Demographics/Regions

From Ways of Darkness

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

local countries_json = mw.title.new( 'Demographics/Countries.json', 'Module' )
local countries_data = mw.text.jsonDecode( countries_json:getContent() )
local regions_json = mw.title.new( 'Demographics/Regions.json', 'Module' )
local regions_data = mw.text.jsonDecode( regions_json:getContent() )
local p = {}

for i, row in ipairs(regions_data['regions']) do
	row['country'] = countries_data['countries'][row['countryID']]
	row['countryID'] = nil
	table.insert(p, row)
end

return p
-- Don't forget to use this - http://www.convertcsv.com/csv-to-json.htm - to convert your tables to JSON, mkay?