lua function call protection
This commit is contained in:
parent
950b8e1564
commit
184bc94aa1
@ -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);
|
||||||
|
@ -582,28 +582,30 @@ 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);
|
||||||
vector<LUAData*>* data = spell->spell->GetLUAData();
|
if(functionCall.length() > 0) {
|
||||||
for(int32 i=0;i<data->size();i++){
|
vector<LUAData*>* data = spell->spell->GetLUAData();
|
||||||
switch(data->at(i)->type){
|
for(int32 i=0;i<data->size();i++){
|
||||||
case 0:{
|
switch(data->at(i)->type){
|
||||||
lua_interface->SetSInt32Value(spell->state, data->at(i)->int_value);
|
case 0:{
|
||||||
break;
|
lua_interface->SetSInt32Value(spell->state, data->at(i)->int_value);
|
||||||
}
|
break;
|
||||||
case 1:{
|
}
|
||||||
lua_interface->SetFloatValue(spell->state, data->at(i)->float_value);
|
case 1:{
|
||||||
break;
|
lua_interface->SetFloatValue(spell->state, data->at(i)->float_value);
|
||||||
}
|
break;
|
||||||
case 2:{
|
}
|
||||||
lua_interface->SetBooleanValue(spell->state, data->at(i)->bool_value);
|
case 2:{
|
||||||
break;
|
lua_interface->SetBooleanValue(spell->state, data->at(i)->bool_value);
|
||||||
}
|
break;
|
||||||
case 3:{
|
}
|
||||||
lua_interface->SetStringValue(spell->state, data->at(i)->string_value.c_str());
|
case 3:{
|
||||||
break;
|
lua_interface->SetStringValue(spell->state, data->at(i)->string_value.c_str());
|
||||||
}
|
break;
|
||||||
default:{
|
}
|
||||||
LogWrite(SPELL__ERROR, 0, "Spell", "Error: Unknown LUA Type '%i' in SpellProcess::ProcessSpell for Spell '%s'", (int)data->at(i)->type, spell->spell->GetName());
|
default:{
|
||||||
return string("");
|
LogWrite(SPELL__ERROR, 0, "Spell", "Error: Unknown LUA Type '%i' in SpellProcess::ProcessSpell for Spell '%s'", (int)data->at(i)->type, spell->spell->GetName());
|
||||||
|
return string("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user