Module:Creatures: Difference between revisions
Jump to navigation
Jump to search
Created page with "return { Griffin = { name = Griffin, attack = 7, defense = 5, speed = 6, }, Centaur = { name = Centaur, attack = 5, defense = 3, speed = 8, } }" |
No edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
return { | return { | ||
Griffin = { | Griffin = { | ||
upgrade = "Royal Griffin", | |||
attack = 7, | attack = 7, | ||
defense = 5, | defense = 5, | ||
| Line 7: | Line 7: | ||
}, | }, | ||
Centaur = { | Centaur = { | ||
upgrade = "Centaur Captain", | |||
attack = 5, | attack = 5, | ||
defense = 3, | defense = 3, | ||
Latest revision as of 21:16, 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