chat.lua 1.2 KB

12345678910111213141516171819202122232425262728
  1. ---@meta
  2. ---Chat command definition
  3. --------------------------
  4. -- Used by `minetest.register_chatcommand`.
  5. ---@class mt.ChatCmdDef
  6. -- Short parameter description.
  7. --
  8. -- Use of symbols is as follows:
  9. --
  10. -- * `<>` signifies a placeholder to be replaced when the command is used. For
  11. -- example, when a player name is needed: `<name>`
  12. -- * `[]` signifies param is optional and not required when the command is used.
  13. -- For example, if you require param1 but param2 is optional:
  14. -- `<param1> [<param2>]`
  15. -- * `|` signifies exclusive or. The command requires one param from the options
  16. -- provided. For example: `<param1> | <param2>`
  17. -- * `()` signifies grouping. For example, when param1 and param2 are both
  18. -- required, or only param3 is required: `(<param1> <param2>) | <param3>`
  19. ---@field params string
  20. ---@field description string Full description.
  21. ---@field privs table Require the "privs" privilege to run.
  22. -- * Called when command is run.
  23. -- * Returns boolean success and text output.
  24. -- * Special case: The help message is shown to the player if `func`
  25. -- returns false without a text output.
  26. ---@field func fun(name:string, param:string): boolean|nil, string|nil