summaryrefslogtreecommitdiff
path: root/src/plugins/lua/weechat-lua-api.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-06-24 07:54:42 +0200
committerSébastien Helleu <flashcode@flashtux.org>2015-06-24 07:54:42 +0200
commit2bd2d74a0720f02d9e5587331659c4d1bbd4e97f (patch)
treec3c448fbfa5b7dd235c76eb7b235a5fc06ef2dbb /src/plugins/lua/weechat-lua-api.c
parent6668b9869bd8c02196e51776d44465ccfce4a9bc (diff)
downloadweechat-2bd2d74a0720f02d9e5587331659c4d1bbd4e97f.zip
api: add function string_eval_path_home()
Diffstat (limited to 'src/plugins/lua/weechat-lua-api.c')
-rw-r--r--src/plugins/lua/weechat-lua-api.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index ce704a73d..2b3270a92 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -441,6 +441,43 @@ API_FUNC(string_eval_expression)
API_RETURN_STRING_FREE(result);
}
+API_FUNC(string_eval_path_home)
+{
+ const char *path;
+ struct t_hashtable *pointers, *extra_vars, *options;
+ char *result;
+
+ API_INIT_FUNC(1, "string_eval_path_home", API_RETURN_EMPTY);
+ if (lua_gettop (L) < 4)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
+
+ path = lua_tostring (L, -4);
+ pointers = weechat_lua_tohashtable (L, -3,
+ WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_POINTER);
+ extra_vars = weechat_lua_tohashtable (L, -2,
+ WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING);
+ options = weechat_lua_tohashtable (L, -1,
+ WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING);
+
+ result = weechat_string_eval_path_home (path, pointers, extra_vars,
+ options);
+
+ if (pointers)
+ weechat_hashtable_free (pointers);
+ if (extra_vars)
+ weechat_hashtable_free (extra_vars);
+ if (options)
+ weechat_hashtable_free (options);
+
+ API_RETURN_STRING_FREE(result);
+}
+
API_FUNC(mkdir_home)
{
const char *directory;
@@ -4957,6 +4994,7 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
API_DEF_FUNC(string_is_command_char),
API_DEF_FUNC(string_input_for_buffer),
API_DEF_FUNC(string_eval_expression),
+ API_DEF_FUNC(string_eval_path_home),
API_DEF_FUNC(mkdir_home),
API_DEF_FUNC(mkdir),
API_DEF_FUNC(mkdir_parents),