1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-15 03:23:23 +00:00

player/lua: use mp_msg_find_level in check_loglevel

Fixes off by one error. Allows to use MSGL_STATS, but since this is
internal value, this is mostly cosmetic change.
This commit is contained in:
Kacper Michajłow 2023-10-23 23:42:17 +02:00 committed by Dudemanguy
parent 29e677fea5
commit 2f91e1441e

View File

@ -487,10 +487,9 @@ error_out:
static int check_loglevel(lua_State *L, int arg)
{
const char *level = luaL_checkstring(L, arg);
for (int n = 0; n < MSGL_MAX; n++) {
if (mp_log_levels[n] && strcasecmp(mp_log_levels[n], level) == 0)
int n = mp_msg_find_level(level);
if (n >= 0)
return n;
}
luaL_error(L, "Invalid log level '%s'", level);
abort();
}