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

Method LuaCommand

src/auto4_lua.cpp:696–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

694 }
695
696 LuaCommand::LuaCommand(lua_State *L)
697 : LuaFeature(L)
698 , display(check_wxstring(L, 1))
699 , help(get_wxstring(L, 2))
700 , cmd_type(cmd::COMMAND_NORMAL)
701 {
702 lua_getfield(L, LUA_REGISTRYINDEX, "filename");
703 cmd_name = agi::format("automation/lua/%s/%s", check_string(L, -1), check_string(L, 1));
704
705 if (!lua_isfunction(L, 3))
706 error(L, "The macro processing function must be a function");
707
708 if (lua_isfunction(L, 4))
709 cmd_type |= cmd::COMMAND_VALIDATE;
710
711 if (lua_isfunction(L, 5))
712 cmd_type |= cmd::COMMAND_TOGGLE;
713
714 // new table for containing the functions for this feature
715 lua_createtable(L, 0, 3);
716
717 // store processing function
718 push_value(L, "run");
719 lua_pushvalue(L, 3);
720 lua_rawset(L, -3);
721
722 // store validation function
723 push_value(L, "validate");
724 lua_pushvalue(L, 4);
725 lua_rawset(L, -3);
726
727 // store active function
728 push_value(L, "isactive");
729 lua_pushvalue(L, 5);
730 lua_rawset(L, -3);
731
732 // store the table in the registry
733 RegisterFeature();
734
735 LuaScript::GetScriptObject(L)->RegisterCommand(this);
736 }
737
738 LuaCommand::~LuaCommand()
739 {

Callers

nothing calls this directly

Calls 7

get_wxstringFunction · 0.85
check_stringFunction · 0.85
errorFunction · 0.85
push_valueFunction · 0.85
RegisterCommandMethod · 0.80
check_wxstringFunction · 0.70
formatFunction · 0.70

Tested by

no test coverage detected