summaryrefslogtreecommitdiff
path: root/src/plugins/lua/weechat-lua-api.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-09-09 08:54:33 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-09-09 08:54:33 +0200
commitd9555cc5679eebbfa8d5d03c34a6f63e516c7a04 (patch)
treee647dfb2e0acbd1f1c493de96ed25550a0d2b9a1 /src/plugins/lua/weechat-lua-api.c
parent9fada89f96f7b702b8d4c9927badb7155a0c8adf (diff)
downloadweechat-d9555cc5679eebbfa8d5d03c34a6f63e516c7a04.zip
scripts: add functions config_enum and config_enum_default in scripting API (issue #1973)
Diffstat (limited to 'src/plugins/lua/weechat-lua-api.c')
-rw-r--r--src/plugins/lua/weechat-lua-api.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index b22014c90..dfe38116f 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -1708,6 +1708,38 @@ API_FUNC(config_color_default)
API_RETURN_STRING(result);
}
+API_FUNC(config_enum)
+{
+ const char *option;
+ int value;
+
+ API_INIT_FUNC(1, "config_enum", API_RETURN_INT(0));
+ if (lua_gettop (L) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ option = lua_tostring (L, -1);
+
+ value = weechat_config_enum (API_STR2PTR(option));
+
+ API_RETURN_INT(value);
+}
+
+API_FUNC(config_enum_default)
+{
+ const char *option;
+ int value;
+
+ API_INIT_FUNC(1, "config_enum_default", API_RETURN_INT(0));
+ if (lua_gettop (L) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ option = lua_tostring (L, -1);
+
+ value = weechat_config_enum_default (API_STR2PTR(option));
+
+ API_RETURN_INT(value);
+}
+
API_FUNC(config_write_option)
{
const char *config_file, *option;
@@ -5531,6 +5563,8 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
API_DEF_FUNC(config_string_default),
API_DEF_FUNC(config_color),
API_DEF_FUNC(config_color_default),
+ API_DEF_FUNC(config_enum),
+ API_DEF_FUNC(config_enum_default),
API_DEF_FUNC(config_write_option),
API_DEF_FUNC(config_write_line),
API_DEF_FUNC(config_write),