Skip to content

Commit

Permalink
player/lua: use mp_msg_find_level in check_loglevel
Browse files Browse the repository at this point in the history
Fixes off by one error. Allows to use MSGL_STATS, but since this is
internal value, this is mostly cosmetic change.
  • Loading branch information
kasper93 authored and Dudemanguy committed Oct 27, 2023
1 parent 29e677f commit 2f91e14
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions player/lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,9 @@ static int load_lua(struct mp_script_args *args)
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)
return n;
}
int n = mp_msg_find_level(level);
if (n >= 0)
return n;
luaL_error(L, "Invalid log level '%s'", level);
abort();
}
Expand Down

0 comments on commit 2f91e14

Please sign in to comment.