| 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) |
no test coverage detected