Subcommands

Image placeholder

Description

This mod adds an API to create commands with subcommands.

Functions 🔗

subcommands.register_command_with_subcommand(name, def) 🔗

The definition table is similar to the Chat command definition for the Minetest API, except:

  • The func field should be left empty
  • The _sc_def field should be a table of subcommands. Each entry should be indexed by the name of the subcommand and have the following definition:
{
	description = "subcommand description",
	params = "<params>",
	privs = {required_privs = true}, -- Optional
	func = function(name,param) return true,"The function" end -- Just like func in minetest.register_chatcommand
}

The help subcommand is reserved and should not be used

subcommands.subcommand_handler(sc_def,cm_name) 🔗

Returns a handler for the command. This is mainly intended for internal use.

  • sc_def: subcommand definition (see above)
  • cm_name: name of the command

Code example 🔗

Reviews

Review

Do you recommend this mod?

  • No reviews, yet.

Releases

v1.3-stable

Download

2021-06-07 23:20 UTC

v1.3-stable 🔗

No release notes

v1.2-stable

Download

2021-04-30 03:09 UTC

v1.2-stable 🔗

No release notes

v1.1-stable

Download

2021-01-05 03:27 UTC

v1.1-stable 🔗

No release notes

v1.0-stable-minor1

Download

2020-11-25 06:37 UTC

v1.0-stable-minor1 🔗

No release notes

v1.0-stable

Download

2020-11-02 11:26 UTC

v1.0-stable 🔗

No release notes

All releases