History

lua: simplify further

As suggested by avih. Obviously this was unnecessarily convoluted.

wm4 committed 6 years ago

Commit 8a58a691 parent d375cc31 file · +1 −8Browse files

Unified · Split

player/lua.c+1−8
@@ -504,17 +504,10 @@ static int script_wait_event(lua_State *L) · 503 unmodified lines
504 504
505 mpv_event *event = mpv_wait_event(ctx->client, luaL_optnumber(L, 1, 1e20));505 mpv_event *event = mpv_wait_event(ctx->client, luaL_optnumber(L, 1, 1e20));
506 506
507 lua_newtable(L); // event
508
509 struct mpv_node rn;507 struct mpv_node rn;
510 mpv_event_to_node(&rn, event);508 mpv_event_to_node(&rn, event);
511 509
512 assert(rn.format == MPV_FORMAT_NODE_MAP);510 pushnode(L, &rn); // event
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 }
518 511
519 mpv_free_node_contents(&rn);512 mpv_free_node_contents(&rn);
520 513

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t