1
0

lua function call protection

This commit is contained in:
Emagi 2024-09-02 09:45:36 -04:00
parent 950b8e1564
commit 184bc94aa1
2 changed files with 24 additions and 26 deletions

View File

@ -584,9 +584,6 @@ std::string LuaInterface::AddSpawnPointers(LuaSpell* spell, bool first_cast, boo
lua_pop(spell->state, 1); lua_pop(spell->state, 1);
return string(""); return string("");
} }
else {
lua_getglobal(spell->state, functionCalled.c_str());
}
if(passLuaSpell) if(passLuaSpell)
SetSpellValue(spell->state, spell); SetSpellValue(spell->state, spell);
@ -858,7 +855,6 @@ void LuaInterface::RemoveSpell(LuaSpell* spell, bool call_remove_function, bool
lua_pop(spell->state, 1); lua_pop(spell->state, 1);
} }
else { else {
lua_getglobal(spell->state, "remove");
LUASpawnWrapper* spawn_wrapper = new LUASpawnWrapper(); LUASpawnWrapper* spawn_wrapper = new LUASpawnWrapper();
spawn_wrapper->spawn = spell->caster; spawn_wrapper->spawn = spell->caster;
AddUserDataPtr(spawn_wrapper, spawn_wrapper->spawn); AddUserDataPtr(spawn_wrapper, spawn_wrapper->spawn);

View File

@ -582,6 +582,7 @@ bool SpellProcess::ProcessSpell(LuaSpell* spell, bool first_cast, const char* fu
std::string SpellProcess::ApplyLuaFunction(LuaSpell* spell, bool first_cast, const char* function, SpellScriptTimer* timer, Spawn* altTarget) std::string SpellProcess::ApplyLuaFunction(LuaSpell* spell, bool first_cast, const char* function, SpellScriptTimer* timer, Spawn* altTarget)
{ {
std::string functionCall = lua_interface->AddSpawnPointers(spell, first_cast, false, function, timer, false, altTarget); std::string functionCall = lua_interface->AddSpawnPointers(spell, first_cast, false, function, timer, false, altTarget);
if(functionCall.length() > 0) {
vector<LUAData*>* data = spell->spell->GetLUAData(); vector<LUAData*>* data = spell->spell->GetLUAData();
for(int32 i=0;i<data->size();i++){ for(int32 i=0;i<data->size();i++){
switch(data->at(i)->type){ switch(data->at(i)->type){
@ -607,6 +608,7 @@ std::string SpellProcess::ApplyLuaFunction(LuaSpell* spell, bool first_cast, con
} }
} }
} }
}
return functionCall; return functionCall;
} }