Wizards of Lua — Commands¶
This document describes the available commands provided by the Wizards of Lua mod.
/lua <code>¶
Permission: wizardsoflua.lua (Default: Operator Level 2)
Argument: <code> – A string of Lua code to execute
Executes a Lua code snippet immediately as a spell.
Examples:
/lua print("Hello, " .. spell.owner.name)
/lua spell.block = Block:new("gold_block")
/lua for i = 1, 10 do spell:move("up"); spell.block = Block:new("glass") end
A spell runs until its code ends. This one runs until it is broken, and it is named, so that the
/wol spell commands below can find it:
/wol¶
Permission: wizardsoflua.wol (Default: Operator Level 2)
Serves as the parent command for Wizards of Lua management and configuration.
/wol extract api¶
Permission: wizardsoflua.wol.extract.api (Default: Operator Level 2)
Regenerates the Lua API documentation files in the config/wizards-of-lua/api directory.
Example:
Point your editor's Lua extension at that directory, and it knows the Wizards of Lua API./wol extract examples¶
Permission: wizardsoflua.wol.extract.examples (Default: Operator Level 2)
Extracts the example files into the config/wizards-of-lua/examples directory. If that directory
already contains files, the command refuses, so that nothing you added or changed there is lost.
Example:
The second command runs the examples'startup.lua files, which register their commands, e.g.
/miner and /guards.
/wol extract examples overwrite¶
Permission: wizardsoflua.wol.extract.examples (Default: Operator Level 2)
Deletes everything in the config/wizards-of-lua/examples directory, including files you added or
changed there, and then extracts the example files. Use it to get the examples of a new version of
the mod.
Example:
/wol startup¶
Permission: wizardsoflua.wol.startup (Default: Operator Level 2)
Executes the startup sequence manually instead of during server startup.
Upon execution, the mod stops all running spells then recursively searches for every startup.lua file, launching those in parent directories first and those in subdirectories afterward.
Example: after you changed a startup.lua, run it without restarting the server:
/wol spell break¶
Permission: wizardsoflua.wol.spell.break (Default: Operator Level 2)
Breaks all spells owned by the command source.
Example: break every spell you cast, e.g. the clock from the /lua example:
/wol spell break all¶
Permission: wizardsoflua.wol.spell.break.all (Default: Operator Level 2)
Breaks all active spells.
Example:
This also breaks the spells of other players, and those started bystartup.lua files, e.g. the
ones that keep the examples' guards at their posts.
/wol spell break bySid <sid>¶
Permission: wizardsoflua.wol.spell.break.bySid (Default: Operator Level 2)
Argument: <sid> – The ID of the spell to break
Breaks a spell by its unique spell ID.
Example: /wol spell list shows each spell's ID, e.g. #12 clock: .... Break that one:
/wol spell break byName <name>¶
Permission: wizardsoflua.wol.spell.break.byName (Default: Operator Level 2)
Argument: <name> – The name of the spell to break
Breaks all spells with the given name. A name with spaces goes in double quotes.
Examples:
/wol spell break byTag <tag>¶
Permission: wizardsoflua.wol.spell.break.byTag (Default: Operator Level 2)
Argument: <tag> – A tag of the spells to break
Breaks all spells that have the given tag (see Spell.tags).
Example: spells that belong together get the same tag, and then break together:
/lua spell:addTag("fireworks"); while true do spell:executeSilent("summon firework_rocket ~ ~ ~"); sleep(40) end
/lua spell:addTag("fireworks"); spell:move("north", 5); while true do spell:executeSilent("summon firework_rocket ~ ~ ~"); sleep(60) end
/wol spell break byTag fireworks
/wol spell break byOwner <player>¶
Permission: wizardsoflua.wol.spell.break.byOwner (Default: Operator Level 2)
Argument: <player> – The name of the player who owns the spell to break
Breaks all spells owned by the specified player.
Example:
/wol spell list¶
Permission: wizardsoflua.wol.spell.list (Default: Operator Level 2)
Lists all spells owned by the command source.
Example:
Each line shows a spell's ID, its name and the beginning of its code, e.g.#12 clock: spell.name = "clock"; while true do ....
/wol spell list all¶
Permission: wizardsoflua.wol.spell.list.all (Default: Operator Level 2)
Lists all active spells.
Example:
/wol spell list bySid <sid>¶
Permission: wizardsoflua.wol.spell.list.bySid (Default: Operator Level 2)
Argument: <sid> – The ID of the spell to list
Lists a spell by its unique spell ID.
Example:
/wol spell list byName <name>¶
Permission: wizardsoflua.wol.spell.list.byName (Default: Operator Level 2)
Argument: <name> – The name of the spell to list
Lists all spells with the given name. A name with spaces goes in double quotes.
Examples:
/wol spell list byTag <tag>¶
Permission: wizardsoflua.wol.spell.list.byTag (Default: Operator Level 2)
Argument: <tag> – A tag of the spells to list
Lists all spells that have the given tag (see Spell.tags).
Example: the spells of all miners from the Miner example, which tags them miner:
/wol spell list byOwner <player>¶
Permission: wizardsoflua.wol.spell.list.byOwner (Default: Operator Level 2)
Argument: <player> – The name of the player who owns the spell to list
Lists all spells owned by the specified player.
Example:
What’s next?¶
- Find out how to register Dynamic Commands.