Module:Map series
Jump to navigation
Jump to search
The actual list of map series is stored in Module:Map series/map series
Subpages
Usage
{{#invoke:Map series|function_name}}
The above documentation is transcluded from Module:Map series/doc.
Editors can experiment in this module's sandbox and testcases pages.
Subpages of this module.
Editors can experiment in this module's sandbox and testcases pages.
Subpages of this module.
-------------------------------------------------------------------------------
--
-- Module:Map series
--
-------------------------------------------------------------------------------
require('Module:No globals')
local m_cargo = require('Module:Cargo')
-- ----------------------------------------------------------------------------
-- Cargo tables
-- ----------------------------------------------------------------------------
local tables = {}
tables.map_series = {
table = 'map_series',
order = {'ordinal', 'id', 'name'},
fields = {
ordinal = {
field = 'ordinal',
type = 'Integer',
},
id = {
field = 'id',
type = 'String',
},
name = {
field = 'name',
type = 'String',
},
},
}
-- ----------------------------------------------------------------------------
-- Exported functions
-- ----------------------------------------------------------------------------
local p = {}
p.table_map_series = m_cargo.declare_factory{data=tables.map_series}
p.store_data = m_cargo.store_from_lua{tables=tables, module='Map series'}
function p.current_map_series()
local results = m_cargo.query(
{tables.map_series.table},
{tables.map_series.fields.name.field},
{
orderBy = tables.map_series.fields.ordinal.field .. ' DESC',
limit = 1,
}
)
if #results < 1 then
error('No map series found.')
end
return results[1].name
end
return p