From 75d3267b43093161f94db5199bd36f14c06b7457 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 17 Feb 2014 02:33:47 +0100 Subject: client API: add a client message event This comes with a "script_message" input command, which sends these messages. Used by the following commits. --- player/lua.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'player/lua.c') diff --git a/player/lua.c b/player/lua.c index 576a2395d6..dbe97cc278 100644 --- a/player/lua.c +++ b/player/lua.c @@ -421,9 +421,22 @@ static int script_wait_event(lua_State *L) lua_setfield(L, -2, "type"); // event break; } + case MPV_EVENT_CLIENT_MESSAGE: { + mpv_event_client_message *msg = event->data; + + lua_newtable(L); // event args + for (int n = 0; n < msg->num_args; n++) { + lua_pushinteger(L, n + 1); // event args N + lua_pushstring(L, msg->args[n]); // event args N val + lua_settable(L, -3); // event args + } + lua_setfield(L, -2, "args"); // event + break; + } default: ; } + // return event return 1; } -- cgit v1.2.3