Difference between revisions of "Module:Database"
From Cassette Beasts
m (Tomc moved page Module:Species to Module:Database without leaving a redirect) |
|||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
− | local | + | local db = mw.loadData("Module:Database/data") |
function p.listSpecies(frame) | function p.listSpecies(frame) | ||
local result = "" | local result = "" | ||
− | for | + | for index, species in pairs(db.species.by_index) do |
if result ~= "" then | if result ~= "" then | ||
− | result = result .. "\n" | + | result = result .. "\n\n" |
end | end | ||
− | result = result .. string.format("%s #%03d", species.name, | + | result = result .. string.format("%s #%03d", species.name, index) |
end | end | ||
return result | return result |
Revision as of 19:08, 21 May 2022
Documentation for this module may be created at Module:Database/doc
local p = {}
local db = mw.loadData("Module:Database/data")
function p.listSpecies(frame)
local result = ""
for index, species in pairs(db.species.by_index) do
if result ~= "" then
result = result .. "\n\n"
end
result = result .. string.format("%s #%03d", species.name, index)
end
return result
end
return p