Module:Creatures: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
return { | return { | ||
{ | |||
name = "Griffin", | name = "Griffin", | ||
attack = 7, | attack = 7, | ||
| Line 6: | Line 6: | ||
speed = 6, | speed = 6, | ||
}, | }, | ||
{ | |||
name = "Centaur", | name = "Centaur", | ||
attack = 5, | attack = 5, | ||
Revision as of 20:35, 28 March 2025
This module is meant to be loaded by other modules. For example:
local p = {}
function p.test(frame)
return creatureTest()
end
function creatureTest(items)
local items = loadData("Creatures")
local result = ""
for k, v in pairs(items) do
result = result .. k .. "'s attack is " .. v["attack"] .. ", "
end
result = result:sub(1, -3)
return result
end
function loadData(name)
if mw.title.new(name, 828).exists then
return mw.loadData("Module:" .. name)
end
return nil
end
return p