summaryrefslogtreecommitdiffstats
path: root/player/lua.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-01-16 21:37:29 +0100
committerwm4 <wm4@nowhere>2014-01-16 23:06:41 +0100
commite10e1a57d07f947727046750c1b7e6d505d1f5fc (patch)
treebc7c2a8abd63968d1b01beeac0ee6087d1d0d52e /player/lua.c
parentd646d78ccb2fac0ac1a052dc4c9edef3ba734d62 (diff)
downloadmpv-e10e1a57d07f947727046750c1b7e6d505d1f5fc.tar.bz2
mpv-e10e1a57d07f947727046750c1b7e6d505d1f5fc.tar.xz
lua: use core log level names
When the Lua code was written, the core didn't have names for log levels yet (just numbers). The only user visible change is that "verbose" becomes "v", since this level had different names.
Diffstat (limited to 'player/lua.c')
-rw-r--r--player/lua.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/player/lua.c b/player/lua.c
index 5aae0a4b7f..a9aebf90ca 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -258,20 +258,11 @@ static void kill_script(struct script_ctx *ctx)
talloc_free(ctx);
}
-static const char *log_level[] = {
- [MSGL_FATAL] = "fatal",
- [MSGL_ERR] = "error",
- [MSGL_WARN] = "warn",
- [MSGL_INFO] = "info",
- [MSGL_V] = "verbose",
- [MSGL_DEBUG] = "debug",
-};
-
static int check_loglevel(lua_State *L, int arg)
{
const char *level = luaL_checkstring(L, arg);
- for (int n = 0; n < MP_ARRAY_SIZE(log_level); n++) {
- if (log_level[n] && strcasecmp(log_level[n], level) == 0)
+ for (int n = 0; n < MSGL_MAX; n++) {
+ if (mp_log_levels[n] && strcasecmp(mp_log_levels[n], level) == 0)
return n;
}
luaL_error(L, "Invalid log level '%s'", level);