Module:Demographics/Regions

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?