Difference between revisions of "Module:Database"
From Cassette Beasts
(Created page with "local s = mw.title.new('Data:Species'):getContent() return mw.text.jsonDecode(s)") |
|||
Line 1: | Line 1: | ||
− | local | + | local p = {} |
− | + | ||
+ | local species_db = mw.loadData("Module:Species/data") | ||
+ | |||
+ | function p.listSpecies(frame) | ||
+ | local result = "" | ||
+ | for species in species_db do | ||
+ | if result ~= "" then | ||
+ | result = result .. "\n" | ||
+ | end | ||
+ | result = result .. string.format("%s #%03d", species.name, species.bestiary_index) | ||
+ | end | ||
+ | return result | ||
+ | end | ||
+ | |||
+ | return p |
Revision as of 22:52, 20 May 2022
Documentation for this module may be created at Module:Database/doc
local p = {}
local species_db = mw.loadData("Module:Species/data")
function p.listSpecies(frame)
local result = ""
for species in species_db do
if result ~= "" then
result = result .. "\n"
end
result = result .. string.format("%s #%03d", species.name, species.bestiary_index)
end
return result
end
return p