Add aegisub.cancel(), which immediates ends macro execution without applying any of the changes that have been made
Originally committed to SVN as r6325.
This commit is contained in:
parent
632a02bcc9
commit
64c7043123
2 changed files with 13 additions and 3 deletions
|
@ -263,6 +263,7 @@ namespace Automation4 {
|
|||
set_field(L, "video_size", LuaVideoSize);
|
||||
set_field(L, "keyframes", LuaGetKeyframes);
|
||||
set_field(L, "decode_path", LuaDecodePath);
|
||||
set_field(L, "cancel", LuaCancel);
|
||||
set_field(L, "lua_automation_version", 4);
|
||||
|
||||
// store aegisub table to globals
|
||||
|
@ -525,14 +526,22 @@ namespace Automation4 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int LuaScript::LuaCancel(lua_State *L)
|
||||
{
|
||||
lua_pushnil(L);
|
||||
return lua_error(L);
|
||||
}
|
||||
|
||||
static void lua_threaded_call(ProgressSink *ps, lua_State *L, int nargs, int nresults, bool can_open_config, bool *failed)
|
||||
{
|
||||
LuaProgressSink lps(L, ps, can_open_config);
|
||||
|
||||
if (lua_pcall(L, nargs, nresults, 0)) {
|
||||
if (!lua_isnil(L, -1)) {
|
||||
// if the call failed, log the error here
|
||||
ps->Log("\n\nLua reported a runtime error:\n");
|
||||
ps->Log(lua_tostring(L, -1));
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
*failed = true;
|
||||
}
|
||||
|
|
|
@ -310,6 +310,7 @@ namespace Automation4 {
|
|||
static int LuaVideoSize(lua_State *L);
|
||||
static int LuaGetKeyframes(lua_State *L);
|
||||
static int LuaDecodePath(lua_State *L);
|
||||
static int LuaCancel(lua_State *L);
|
||||
|
||||
public:
|
||||
LuaScript(const wxString &filename);
|
||||
|
|
Loading…
Reference in a new issue