Module:Demographics/Areas

From Ways of Darkness
Jump to navigation Jump to search

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

local regions = require( 'Module:Demographics/Regions' )
local areas_json = mw.title.new( 'Demographics/Areas.json', 'Module' )
local areas_data = mw.text.jsonDecode( areas_json:getContent() )
local p = {}

for i, row in ipairs(areas_data['areas']) do
	row['region'] = regions[row['regionID']]
	row['regionID'] = 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?