Module:Demographics/Pops

local religion_json = mw.title.new( 'Demographics/Religions.json', 'Module' ) local religion_data = mw.text.jsonDecode( religion_json:getContent ) local races_json = mw.title.new( 'Demographics/Races.json', 'Module' ) local races_data = mw.text.jsonDecode( races_json:getContent ) local occupations_json = mw.title.new( 'Demographics/Occupations.json', 'Module' ) local occupations_data = mw.text.jsonDecode( occupations_json:getContent ) local agegroups_json = mw.title.new( 'Demographics/AgeGroups.json', 'Module' ) local agegroups_data = mw.text.jsonDecode( agegroups_json:getContent ) local areas = mw.loadData( 'Module:LoadJsonTest/Areas' ) local p = {}

for i, row in ipairs(regions_data['regions']) do	row['area'] = areas[row['areaID']] row['areaID'] = nil row['religion'] = religion_data['religions'][row['religionID']] row['religionID'] = nil row['race'] = races_data['races'][row['raceId']] row['raceId'] = nil row['occupation'] = occupations_data['occupations'][row['occupationID']] row['occupationID'] = nil row['agegroup'] = agegroups_data['agegroups'][row['agegroupID']] row['agegroupID'] = 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?