mirror of https://github.com/mpv-player/mpv
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.)
This commit is contained in:
parent
a714ab0601
commit
8e5642ff68
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue