summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-18 00:33:32 +0100
committerwm4 <wm4@nowhere>2019-11-18 00:44:54 +0100
commit8e5642ff6872d94faf69c6305acdcfd788ddebba (patch)
tree4c23c176ba7c791cf2998a038b72c5c72c736822
parenta714ab0601908131756c3a2074c1fab9a7cddb18 (diff)
downloadmpv-8e5642ff6872d94faf69c6305acdcfd788ddebba.tar.bz2
mpv-8e5642ff6872d94faf69c6305acdcfd788ddebba.tar.xz
lua: don't pre-filter log level argument in mp.enable_messages()
This will just make it not work if mpv_request_log_messages() gets extended to accept more names. Pass the argument without checking. To keep the behavior the same (for whatever reasons, probably not important), still raise an error if the libmpv API function returns an error that the argument was bad. (The check_loglevel() function is still used when the script _emits_ log messages, which is different, and for which there is no API anyway.)
-rw-r--r--player/lua.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/player/lua.c b/player/lua.c
index 757f449f7b..63b9b1f8c1 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -596,9 +596,11 @@ static int script_request_event(lua_State *L)
static int script_enable_messages(lua_State *L)
{
struct script_ctx *ctx = get_ctx(L);
- check_loglevel(L, 1);
const char *level = luaL_checkstring(L, 1);
- return check_error(L, mpv_request_log_messages(ctx->client, level));
+ int r = mpv_request_log_messages(ctx->client, level);
+ if (r == MPV_ERROR_INVALID_PARAMETER)
+ luaL_error(L, "Invalid log level '%s'", level);
+ return check_error(L, r);
}
static int script_command(lua_State *L)