From 65cd9efa850faaedb9f866632feb9fee2ef71462 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 4 Feb 2020 20:40:16 +0100 Subject: lua: add mp.get_script_directory() function And add some clarifications/suggestions to the manpage. --- player/lua.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'player') diff --git a/player/lua.c b/player/lua.c index 5934492bdf..521a76b4f9 100644 --- a/player/lua.c +++ b/player/lua.c @@ -455,6 +455,16 @@ static int script_find_config_file(lua_State *L) return 1; } +static int script_get_script_directory(lua_State *L) +{ + struct script_ctx *ctx = get_ctx(L); + if (ctx->path) { + lua_pushstring(L, ctx->path); + return 1; + } + return 0; +} + static int script_suspend(lua_State *L) { struct script_ctx *ctx = get_ctx(L); @@ -1228,6 +1238,7 @@ static const struct fn_entry main_fns[] = { FN_ENTRY(wait_event), FN_ENTRY(request_event), FN_ENTRY(find_config_file), + FN_ENTRY(get_script_directory), FN_ENTRY(command), FN_ENTRY(commandv), FN_ENTRY(command_native), -- cgit v1.2.3