mirror of
https://github.com/weechat/weechat.git
synced 2026-06-25 20:36:38 +02:00
scripts: add functions config_enum and config_enum_default in scripting API (issue #1973)
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user