summaryrefslogtreecommitdiffstats
path: root/player/lua.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-17 02:33:47 +0100
committerwm4 <wm4@nowhere>2014-02-17 02:52:58 +0100
commit75d3267b43093161f94db5199bd36f14c06b7457 (patch)
tree868d2b2c23da83921c6c1546b9d66de71e3d3a35 /player/lua.c
parentfe586dbbdb129e00be6c2b5e6739341dc019ab1c (diff)
downloadmpv-75d3267b43093161f94db5199bd36f14c06b7457.tar.bz2
mpv-75d3267b43093161f94db5199bd36f14c06b7457.tar.xz
client API: add a client message event
This comes with a "script_message" input command, which sends these messages. Used by the following commits.
Diffstat (limited to 'player/lua.c')
-rw-r--r--player/lua.c13
1 files changed, 13 insertions, 0 deletions
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;
}