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

Sobralia
New member
 
Posts: 6
Joined: Tue Jun 07, 2016 12:41
In-game: Sobralia

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

by Sobralia » Mon Jun 13, 2016 17:33

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
Last edited by Sobralia on Sat Jun 18, 2016 12:29, edited 2 times in total.
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

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

by Byakuren » Mon Jun 13, 2016 18:38

Is that correct or should permissions_cmd:register_sub_command be foo_cmd:register_sub_command?
Every time a mod API is left undocumented, a koala dies.
 

Sobralia
New member
 
Posts: 6
Joined: Tue Jun 07, 2016 12:41
In-game: Sobralia

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

by Sobralia » Mon Jun 13, 2016 18:48

Byakuren wrote:Is that correct or should permissions_cmd:register_sub_command be foo_cmd:register_sub_command?


It should be foo_cmd, fixed ^^'
 

Sobralia
New member
 
Posts: 6
Joined: Tue Jun 07, 2016 12:41
In-game: Sobralia

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

by Sobralia » Sat Jun 18, 2016 12:31

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)
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 16 guests

cron