Module:Mine Race

require "Module:Database Miner" require "Module:Demographics Basics" require "Module:Demographics Database"

function mineout(tabula,race) local database = {} database[race] = MineDatabase(tabula,race) return generate(database,race,"Race") end function generate_infobox_data(race,l) local database = {} local temp = "" database[race] = MineDatabase(demographics.race,race) local sortedKeys = getKeysSortedByValue(database[race], function(a, b) return a > b end) local i = l   for _, key in ipairs(sortedKeys) do        temp = temp .. "|region" .. i .. " = \n" temp = temp .. "|pop" .. i .. " = c. '''" .. format_num(database[race][key],0) .. "'''\n" i = i + 1 end return temp end function generate_infobox_markup(race,l) local database = {} local args = {} local temp = "" database[race] = MineDatabase(demographics.race,race) local sortedKeys = getKeysSortedByValue(database[race], function(a, b) return a > b end) local i = l   for _, key in ipairs(sortedKeys) do temp = "region" .. i       args[temp]  = "" temp = "pop" .. i       args[temp] = "c. '''" .. format_num(database[race][key],0) .. "'''"       i = i + 1 end return args end local p = {} function p.main(frame) return mineout(demographics.race,frame.args[1]) end function p.infobox(frame) return frame:expandTemplate{title = 'Infobox race',generate_infobox_markup(frame.args[1],frame.args[2])} end return p