Browse Source

removed benign errors about E LUA : : attempt to call a nil value in a quest script when the function does not exist

Emagi 1 year ago
parent
commit
e40f842ac0
1 changed files with 7 additions and 0 deletions
  1. 7 0
      EQ2/source/WorldServer/LuaInterface.cpp

+ 7 - 0
EQ2/source/WorldServer/LuaInterface.cpp

@@ -417,6 +417,13 @@ bool LuaInterface::CallQuestFunction(Quest* quest, const char* function, Spawn*
 		if(state){
 			int8 arg_count = 3;
 			lua_getglobal(state, function);
+			
+			if (!lua_isfunction(state, lua_gettop(state))){
+				lua_pop(state, 1);
+				mutex->releasereadlock(__FUNCTION__);
+				return false;
+			}
+			
 			SetQuestValue(state, quest);
 			Spawn* spawn = player->GetZone()->GetSpawnByDatabaseID(quest->GetQuestGiver());
 			SetSpawnValue(state, spawn);