summaryrefslogtreecommitdiff
path: root/src/plugins/lua
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-02-28 00:14:38 +0100
committerSébastien Helleu <flashcode@flashtux.org>2019-02-28 20:19:18 +0100
commit80b980b2af71faa9a2d825c61a5d41d7ace0dc60 (patch)
tree64056a5a5fb428869b62c6c0309155c67acbc432 /src/plugins/lua
parent64043d5a6c4ca258c40a8c39d0f58fc4a16c86b9 (diff)
downloadweechat-80b980b2af71faa9a2d825c61a5d41d7ace0dc60.zip
api: add function command_options (issue #928)
Diffstat (limited to 'src/plugins/lua')
-rw-r--r--src/plugins/lua/weechat-lua-api.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index a07709fa1..908097a4c 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -4312,6 +4312,35 @@ API_FUNC(command)
API_RETURN_INT(rc);
}
+API_FUNC(command_options)
+{
+ const char *buffer, *command;
+ struct t_hashtable *options;
+ int rc;
+
+ API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR));
+ if (lua_gettop (L) < 3)
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR));
+
+ buffer = lua_tostring (L, -3);
+ command = lua_tostring (L, -2);
+ options = weechat_lua_tohashtable (L, -1,
+ WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING);
+
+ rc = plugin_script_api_command_options (weechat_lua_plugin,
+ lua_current_script,
+ API_STR2PTR(buffer),
+ command,
+ options);
+
+ if (options)
+ weechat_hashtable_free (options);
+
+ API_RETURN_INT(rc);
+}
+
API_FUNC(info_get)
{
const char *info_name, *arguments, *result;
@@ -5318,6 +5347,7 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
API_DEF_FUNC(bar_update),
API_DEF_FUNC(bar_remove),
API_DEF_FUNC(command),
+ API_DEF_FUNC(command_options),
API_DEF_FUNC(info_get),
API_DEF_FUNC(info_get_hashtable),
API_DEF_FUNC(infolist_new),