summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-02-04 20:40:16 +0100
committerwm4 <wm4@nowhere>2020-02-04 20:40:16 +0100
commit65cd9efa850faaedb9f866632feb9fee2ef71462 (patch)
treea2f5d2bf86df7fb8692207926e1645f008f6bf1f /player
parent6a83187b064959ca55f14b91446d256c8708970f (diff)
downloadmpv-65cd9efa850faaedb9f866632feb9fee2ef71462.tar.bz2
mpv-65cd9efa850faaedb9f866632feb9fee2ef71462.tar.xz
lua: add mp.get_script_directory() function
And add some clarifications/suggestions to the manpage.
Diffstat (limited to 'player')
-rw-r--r--player/lua.c11
1 files changed, 11 insertions, 0 deletions
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),