summaryrefslogtreecommitdiffstats
path: root/player/lua.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:13:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:13:14 +0000
commit60e8a3d404f0640fa5a3f834eae54b4f1fb9127d (patch)
tree1da89a218d0ecf010c67a87cb2f625c4cb18e7d7 /player/lua.c
parentAdding upstream version 0.37.0. (diff)
downloadmpv-85641ae1aad608329bed81c5ced87e668b7f629e.tar.xz
mpv-85641ae1aad608329bed81c5ced87e668b7f629e.zip
Adding upstream version 0.38.0.upstream/0.38.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'player/lua.c')
-rw-r--r--player/lua.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/player/lua.c b/player/lua.c
index 41fd520..6354769 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -61,6 +61,9 @@ static const char * const builtin_lua_scripts[][2] = {
{"mp.assdraw",
# include "player/lua/assdraw.lua.inc"
},
+ {"mp.input",
+# include "player/lua/input.lua.inc"
+ },
{"mp.options",
# include "player/lua/options.lua.inc"
},
@@ -509,7 +512,7 @@ static int script_log(lua_State *L)
const char *s = lua_tostring(L, -1);
if (s == NULL)
return luaL_error(L, "Invalid argument");
- mp_msg(ctx->log, msgl, "%s%s", s, i > 0 ? " " : "");
+ mp_msg(ctx->log, msgl, (i == 2 ? "%s" : " %s"), s);
lua_pop(L, 1); // args... tostring
}
mp_msg(ctx->log, msgl, "\n");
@@ -1184,11 +1187,11 @@ static int script_format_json(lua_State *L, void *tmp)
char *dst = talloc_strdup(tmp, "");
if (json_write(&dst, &node) >= 0) {
lua_pushstring(L, dst);
- lua_pushnil(L);
- } else {
- lua_pushnil(L);
- lua_pushstring(L, "error");
+ return 1;
}
+
+ lua_pushnil(L);
+ lua_pushstring(L, "error");
return 2;
}