mirror of
https://github.com/mpv-player/mpv
synced 2024-12-29 02:22:19 +00:00
lua: simplify further
As suggested by avih. Obviously this was unnecessarily convoluted.
This commit is contained in:
parent
d375cc304a
commit
8a58a69930
@ -504,17 +504,10 @@ static int script_wait_event(lua_State *L)
|
||||
|
||||
mpv_event *event = mpv_wait_event(ctx->client, luaL_optnumber(L, 1, 1e20));
|
||||
|
||||
lua_newtable(L); // event
|
||||
|
||||
struct mpv_node rn;
|
||||
mpv_event_to_node(&rn, event);
|
||||
|
||||
assert(rn.format == MPV_FORMAT_NODE_MAP);
|
||||
mpv_node_list *list = rn.u.list;
|
||||
for (int n = 0; n < list->num; n++) {
|
||||
pushnode(L, &list->values[n]);
|
||||
lua_setfield(L, -2, list->keys[n]);
|
||||
}
|
||||
pushnode(L, &rn); // event
|
||||
|
||||
mpv_free_node_contents(&rn);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user