MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / IsActive

Method IsActive

src/auto4_lua.cpp:899–928  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

897 }
898
899 bool LuaCommand::IsActive(const agi::Context *c)
900 {
901 if (!(cmd_type & cmd::COMMAND_TOGGLE)) return false;
902
903 LuaStackcheck stackcheck(L);
904
905 set_context(L, c);
906 stackcheck.check_stack(0);
907
908 GetFeatureFunction("isactive");
909 auto subsobj = new LuaAssFile(L, c->ass.get());
910 push_value(L, selected_rows(c));
911 if (auto active_line = c->selectionController->GetActiveLine())
912 push_value(L, active_line->Row + c->ass->Info.size() + c->ass->Styles.size() + 1);
913
914 int err = lua_pcall(L, 3, 1, 0);
915 subsobj->ProcessingComplete();
916
917 bool result = false;
918 if (err)
919 wxLogWarning("Runtime error in Lua macro IsActive function:\n%s", get_wxstring(L, -1));
920 else
921 result = !!lua_toboolean(L, -1);
922
923 // clean up stack (result or error message)
924 stackcheck.check_stack(1);
925 lua_pop(L, 1);
926
927 return result;
928 }
929
930 // LuaFeatureFilter
931 LuaExportFilter::LuaExportFilter(lua_State *L)

Callers 3

OnIdleMethod · 0.45
OnPaintMethod · 0.45
UpdateItemMethod · 0.45

Calls 9

set_contextFunction · 0.85
push_valueFunction · 0.85
selected_rowsFunction · 0.85
get_wxstringFunction · 0.85
GetActiveLineMethod · 0.80
ProcessingCompleteMethod · 0.80
check_stackMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected