summaryrefslogtreecommitdiffstats
path: root/player/lua.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-01-26 15:28:51 +0100
committerwm4 <wm4@nowhere>2020-01-26 15:28:51 +0100
commitbc1c024ae032e5b5c2d8beb06cf310636e402de4 (patch)
tree059bfcdcd5b20369fb3c4fd1ba0375bc3da139a4 /player/lua.c
parent80423e5b5534e6e648c53db931c27c74867898e1 (diff)
downloadmpv-bc1c024ae032e5b5c2d8beb06cf310636e402de4.tar.bz2
mpv-bc1c024ae032e5b5c2d8beb06cf310636e402de4.tar.xz
lua: stop setting bogus package path
Scripts are not supposed to be able to "import" anything from mpv's scripts directory, because all these files are loaded by mpv itself.
Diffstat (limited to 'player/lua.c')
-rw-r--r--player/lua.c25
1 files changed, 0 insertions, 25 deletions
diff --git a/player/lua.c b/player/lua.c
index 2e5b0dec5a..6423861f16 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -273,28 +273,6 @@ static int load_scripts(lua_State *L)
return 0;
}
-static void set_path(lua_State *L)
-{
- void *tmp = talloc_new(NULL);
-
- lua_getglobal(L, "package"); // package
- lua_getfield(L, -1, "path"); // package path
- const char *path = lua_tostring(L, -1);
-
- char *newpath = talloc_strdup(tmp, path ? path : "");
- char **luadir = mp_find_all_config_files(tmp, get_mpctx(L)->global, "scripts");
- for (int i = 0; luadir && luadir[i]; i++) {
- newpath = talloc_asprintf_append(newpath, ";%s",
- mp_path_join(tmp, luadir[i], "?.lua"));
- }
-
- lua_pushstring(L, newpath); // package path newpath
- lua_setfield(L, -3, "path"); // package path
- lua_pop(L, 2); // -
-
- talloc_free(tmp);
-}
-
static int run_lua(lua_State *L)
{
struct script_ctx *ctx = lua_touserdata(L, -1);
@@ -348,9 +326,6 @@ static int run_lua(lua_State *L)
assert(lua_gettop(L) == 0);
- set_path(L);
- assert(lua_gettop(L) == 0);
-
// run this under an error handler that can do backtraces
lua_pushcfunction(L, error_handler); // errf
lua_pushcfunction(L, load_scripts); // errf fn