Module:Demographics

From Ways of Darkness
Jump to navigation Jump to search

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

require "Module:Demographics Basics"
require "Module:Demographics Database"
local p = require('Module:Demographics/PopQuery')

function p.all(frame)
    if (frame.args[2] ~= nil) then
    	local data =  p.filterpops(frame.args[2], 0, 0, 0, 0, frame.args[1], 0, 0)
    	local total = 0
    	for k,v in pairs(data) do
    		total = total + v['quantity']
    	end
        return total
    else
    	local data =  p.filterpops(0, 0, 0, 0, 0, frame.args[1], 0, 0)
    	local total = 0
    	for k,v in pairs(data) do
    		total = total + v['quantity']
    	end
        return total
    end
end

return p