From 7651e83314d2b75b5718c1de565e1c38429be06f Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Mon, 23 Sep 2013 14:15:45 -0700 Subject: [PATCH] Fix setting selection/active line from automation scripts The error handling function is under the results of the called function, not at the top of the stack, so lua_pop was removing the wrong thing. --- aegisub/src/auto4_lua.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aegisub/src/auto4_lua.cpp b/aegisub/src/auto4_lua.cpp index 409d462f8..eb3f3ac36 100644 --- a/aegisub/src/auto4_lua.cpp +++ b/aegisub/src/auto4_lua.cpp @@ -720,7 +720,7 @@ namespace Automation4 { lua_pop(L, 1); failed = true; } - lua_pop(L, 1); + lua_remove(L, -nresults - 1); lua_gc(L, LUA_GCCOLLECT, 0); }); @@ -890,7 +890,7 @@ namespace Automation4 { subsobj->ProcessingComplete(StrDisplay(c)); - AssDialogue *active_line = 0; + AssDialogue *active_line = nullptr; int active_idx = 0; // Check for a new active row