Documentation for this module may be created at Module:ExperimentalNavplate/doc
--[[This Mess is an experimental module for seeing if we can create a navplate that populates itself
as an ordered, nested list]]--
local p = {};
local dpl = require( 'Module:DPLlua' )
p.fullplate= function(frame )
-- Get the pages from the category of Stanton System
-- Potential to make this more elegant
local list = dpl.ask({
namespace = '',
category = 'Stanton System',
include='{Infobox Astronomical Object},{Infobox Location}'
} )
--Define categories
local star;
local planets = {};
local moons = {};
local belts = {};
local asteroids = {};
local lzs = {};
local tradehubs = {};
local stations = {};
local spaceport = {};
local rest = {};
local locs = {};
local jps = {};
local other = {}; -- Catchall for anything that has a type set weirdly.
--Iterate through list, place each item in correct category
for i, entry in ipairs(list) do
local entry = list[i]["include"][1]
local type = entry["Type"]
--Ground Locations
if type == nil then
entry = list[i]["include"][2]
type = entry["Type"]
if type == "Landing zone" then
table.insert(lzs,entry)
elseif type == "Landmark" then
table.insert(locs,entry)
elseif type == "Spaceport" then
table.insert(spaceports,entry)
else
table.add(other,entry)
end
-- Space Locations
elseif type == "Star" then
star = entry
elseif type == "Planet" then
table.insert(planets,entry)
elseif type == "Moon" then
table.insert(moons,entry)
elseif type == "Asteroid Belt" then
table.insert(belts,entry)
elseif type == "Trade Hub" then
table.insert(tradehubs,entry)
elseif type == "Space Station" then
table.insert(stations,entry)
elseif type == "Rest Stop" then
table.insert(rest,entry)
elseif type == "Asteroid Formation" then
table.insert(asteroids,entry)
elseif type == "Jump Point" then
table.insert(jps,entry)
else
table.add(other,entry)
end
end
end
return p