As suggested by avih. Obviously this was unnecessarily convoluted.
Unified · Split
| @@ -504,17 +504,10 @@ static int script_wait_event(lua_State *L) · 503 unmodified lines | ||
| 504 | 504 | |
| 505 | 505 | mpv_event *event = mpv_wait_event(ctx->client, luaL_optnumber(L, 1, 1e20)); |
| 506 | 506 | |
| 507 | − lua_newtable(L); // event | |
| 508 | − | |
| 509 | 507 | struct mpv_node rn; |
| 510 | 508 | mpv_event_to_node(&rn, event); |
| 511 | 509 | |
| 512 | − assert(rn.format == MPV_FORMAT_NODE_MAP); | |
| 513 | − mpv_node_list *list = rn.u.list; | |
| 514 | − for (int n = 0; n < list->num; n++) { | |
| 515 | − pushnode(L, &list->values[n]); | |
| 516 | − lua_setfield(L, -2, list->keys[n]); | |
| 517 | − } | |
| 510 | + pushnode(L, &rn); // event | |
| 518 | 511 | |
| 519 | 512 | mpv_free_node_contents(&rn); |
| 520 | 513 | |