diff options
author | wm4 <wm4@nowhere> | 2014-02-26 20:58:17 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-02-26 21:03:36 +0100 |
commit | 11ee72fe1b4304ae16ff45c767c0d9e8f6e6f295 (patch) | |
tree | 956b691a2032397389649ac6074e3e5a5dee5e84 /player/lua.c | |
parent | 25f086973ff267495586c776e79f91bc5ddc44fa (diff) | |
download | mpv-11ee72fe1b4304ae16ff45c767c0d9e8f6e6f295.tar.bz2 mpv-11ee72fe1b4304ae16ff45c767c0d9e8f6e6f295.tar.xz |
lua: implement mp.get_opt() in Lua
Will be more expensive if used very often, but it's probably ok.
Reduce the dependency of lua.c on MPContext a bit further.
Diffstat (limited to 'player/lua.c')
-rw-r--r-- | player/lua.c | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/player/lua.c b/player/lua.c index 9e5e2c96a5..8b0a818ea5 100644 --- a/player/lua.c +++ b/player/lua.c @@ -823,29 +823,6 @@ static int script_format_time(lua_State *L) return 1; } -static int script_get_opt(lua_State *L) -{ - struct MPContext *mpctx = get_mpctx(L); - - mp_dispatch_lock(mpctx->dispatch); - - char **opts = mpctx->opts->lua_opts; - const char *name = luaL_checkstring(L, 1); - int r = 0; - - for (int n = 0; opts && opts[n] && opts[n + 1]; n++) { - if (strcmp(opts[n], name) == 0) { - lua_pushstring(L, opts[n + 1]); - r = 1; - break; - } - } - - mp_dispatch_unlock(mpctx->dispatch); - - return r; -} - struct fn_entry { const char *name; int (*fn)(lua_State *L); @@ -881,7 +858,6 @@ static struct fn_entry fn_list[] = { FN_ENTRY(input_set_section_mouse_area), FN_ENTRY(format_time), FN_ENTRY(enable_messages), - FN_ENTRY(get_opt), }; // On stack: mp table |