summaryrefslogtreecommitdiff
path: root/src/plugins/lua/weechat-lua-api.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-03-03 10:32:11 +0100
committerSébastien Helleu <flashcode@flashtux.org>2024-03-05 19:51:15 +0100
commitc3eff15a566da40e1919b034cd5580378dd3bda7 (patch)
treeebea7d1d9eff1efdd5069f9e4ffb61b1852408a0 /src/plugins/lua/weechat-lua-api.c
parent0bf560f9b72f4cb268132399db135cb33bb529cf (diff)
downloadweechat-c3eff15a566da40e1919b034cd5580378dd3bda7.zip
api: add functions config_option_get_string and config_option_get_pointer in scripting API
Diffstat (limited to 'src/plugins/lua/weechat-lua-api.c')
-rw-r--r--src/plugins/lua/weechat-lua-api.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index 5b2de2079..222ed500a 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -1552,6 +1552,41 @@ API_FUNC(config_option_rename)
API_RETURN_OK;
}
+API_FUNC(config_option_get_string)
+{
+ const char *option, *property, *result;
+
+ API_INIT_FUNC(1, "config_option_get_string", API_RETURN_EMPTY);
+ if (lua_gettop (L) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
+
+ option = lua_tostring (L, -2);
+ property = lua_tostring (L, -1);
+
+ result = weechat_config_option_get_string (API_STR2PTR(option),
+ property);
+
+ API_RETURN_STRING(result);
+}
+
+API_FUNC(config_option_get_pointer)
+{
+ const char *option, *property;
+ const char *result;
+
+ API_INIT_FUNC(1, "config_option_get_pointer", API_RETURN_EMPTY);
+ if (lua_gettop (L) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
+
+ option = lua_tostring (L, -2);
+ property = lua_tostring (L, -1);
+
+ result = API_PTR2STR(weechat_config_option_get_pointer (API_STR2PTR(option),
+ property));
+
+ API_RETURN_STRING(result);
+}
+
API_FUNC(config_option_is_null)
{
const char *option;
@@ -5686,6 +5721,8 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
API_DEF_FUNC(config_option_set_null),
API_DEF_FUNC(config_option_unset),
API_DEF_FUNC(config_option_rename),
+ API_DEF_FUNC(config_option_get_string),
+ API_DEF_FUNC(config_option_get_pointer),
API_DEF_FUNC(config_option_is_null),
API_DEF_FUNC(config_option_default_is_null),
API_DEF_FUNC(config_boolean),