Page 1 of 1

[MOD] LibChatCommand [v0.2.0] [lib_chatcommand] [WIP]

PostPosted: Mon Jun 13, 2016 17:33
by Sobralia
This mod is library that helps you to create commands and subcommand for your mods.

License: GPLv3
Source: Git repo
Wiki: here
Download: LastVersion (v0.2.0)
Changelog: here

Installation with git
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
git clone git@framagit.org:Sobralia/LibChatCommand.git lib_chatcommand


How to use
For more example go to the code sample page of the wiki

To create a foo command and two subcommands (bar and bar2 ie):
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local foo_cmd = ChatCommand.new("foo",{
   params = "", -- if it's a top command, don't fill it
   description = "All command for the foo plugin",
   func = foo_function,
   privs = {foo=true}
   })

-- /foo bar
local foo_bar = foo_cmd:register_sub_command("bar",{
   params = "<val1> <val2>",
   description = "Do a bar with foo",
   func = foo_bar_function,
   privs = {foo_bar=true}
   })

-- /foo bar2
local foo_bar = foo_cmd:register_sub_command("bar2",{
   params = "<val1> <val2>",
   description = "Do a bar2 with foo",
   func = foo_bar2_function,
   privs = {foo_bar2=true}
   })


Planned features
  • Help command (actually does not display help information)
  • Named params

Re: [MOD] LibChatCommand [v0.1.0] [lib_chatcommand] [WIP]

PostPosted: Mon Jun 13, 2016 18:38
by Byakuren
Is that correct or should permissions_cmd:register_sub_command be foo_cmd:register_sub_command?

Re: [MOD] LibChatCommand [v0.1.0] [lib_chatcommand] [WIP]

PostPosted: Mon Jun 13, 2016 18:48
by Sobralia
Byakuren wrote:Is that correct or should permissions_cmd:register_sub_command be foo_cmd:register_sub_command?


It should be foo_cmd, fixed ^^'

Re: [MOD] LibChatCommand [v0.2.0] [lib_chatcommand] [WIP]

PostPosted: Sat Jun 18, 2016 12:31
by Sobralia
Update V0.2.0:
  • Fixe some errors: mods name was wrong in many file
  • Command inheritance support: you can make subcommand that does not depends on parents privileges with options inherit = false (default value is true when not passed)
  • Store registered commands and subcommands for further use (help command ie)