The Spells module provides access to all Spell objects currently loaded.
Here is an overview of the Spells functions:
Function | Parameters | Results |
---|---|---|
find | criteria | table |
Below you find short descriptions about each of the functions and some examples about how to use them in your spells.
The ‘find’ function returns a table of Spell objects that match the given criteria. The criteria is a table of key-value pairs.
The following keys are supported:
Printing the number of all active spells.
found = Spells.find()
print(#found)
Printing the position of the first spell called “welcome”:
found = Spells.find({name="welcome"})[1]
print(found.pos)
Printing the positions of all active spells in a 10-meter range.
found = Spells.find({maxradius=10})
for _,s in pairs(found) do
print(s.pos)
end
Printing the names of all active spells owned by player “mickkay”.
found = Spells.find({owner="mickkay"})
for _,e in pairs(found) do
print(e.name)
end