function call fixes and resets for procs / call spell process
This commit is contained in:
parent
b7802d84db
commit
56e43288bf
@ -1721,6 +1721,7 @@ bool Entity::CastProc(Proc* proc, int8 type, Spawn* target) {
|
||||
else {
|
||||
lua_getglobal(state, "proc");
|
||||
}
|
||||
if (lua_isfunction(state, -1)) {
|
||||
if (item_proc) {
|
||||
num_args++;
|
||||
lua_interface->SetItemValue(state, proc->item);
|
||||
@ -1769,6 +1770,9 @@ bool Entity::CastProc(Proc* proc, int8 type, Spawn* target) {
|
||||
lua_pop(state, 1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
lua_interface->ResetFunctionStack(state);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -674,9 +674,11 @@ bool LuaInterface::CallSpellProcess(LuaSpell* spell, int8 num_parameters, std::s
|
||||
if(lua_pcall(spell->state, num_parameters, 0, 0) != 0){
|
||||
LogError("Error running function '%s' in %s: %s", customFunction.c_str(), spell->spell->GetName(), lua_tostring(spell->state, -1));
|
||||
lua_pop(spell->state, 1);
|
||||
ResetFunctionStack(spell->state);
|
||||
RemoveSpell(spell, false); // may be in a lock
|
||||
return false;
|
||||
}
|
||||
ResetFunctionStack(spell->state);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user