Module:QueryNationSummary

From Victory Belles Community Wiki
Jump to navigation Jump to search

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

local p = {}
local cargo = mw.ext.cargo

function p.main ( frame )
    local tables = "JOINNation"
    local fields = "TXT_IngameNationDescription"

    local cargoArgs = {
        where = "JOINNation.TXT_ShortName = '" .. frame.args.nation .. "'",
		default ='Description not defined',
		limit = 1
    }
    local results = cargo.query( tables, fields, cargoArgs )
    for r = 1, #results do
        local result = results[r]
        if result == nil then
        	return 'Empty Cargo...'
    	else 
        	return result.TXT_IngameNationDescription
    	end
    end
end

return p