Merge branch 'dev' of github.com:sm64ex-coop-dev/sm64ex-coop into dev

This commit is contained in:
MysterD 2023-11-24 15:04:56 -08:00
commit b7b1927872
1 changed files with 5 additions and 5 deletions

View File

@ -1777,7 +1777,7 @@ int smlua_hook_exclamation_box(lua_State* L) {
return 0; return 0;
} }
if (sHookedBehaviorsCount > MAX_HOOKED_EXCLAMATION_BOXES) { if (sHookedExclamationBoxesCount > MAX_HOOKED_EXCLAMATION_BOXES) {
LOG_LUA_LINE("hook_exclamation_box() calls exceeded maximum references"); LOG_LUA_LINE("hook_exclamation_box() calls exceeded maximum references");
return 0; return 0;
} }
@ -1814,7 +1814,7 @@ int smlua_hook_exclamation_box(lua_State* L) {
hooked->mod = gLuaActiveMod; hooked->mod = gLuaActiveMod;
if (!gSmLuaConvertSuccess) { return 0; } if (!gSmLuaConvertSuccess) { return 0; }
sHookedBehaviorsCount++; sHookedExclamationBoxesCount++;
return 1; return 1;
} }
@ -1822,7 +1822,7 @@ int smlua_hook_exclamation_box(lua_State* L) {
struct Object* smlua_call_exclamation_box_hook(struct Object* obj, bool write) { struct Object* smlua_call_exclamation_box_hook(struct Object* obj, bool write) {
lua_State* L = gLuaState; lua_State* L = gLuaState;
if (L == NULL) { return NULL; } if (L == NULL) { return NULL; }
for (int i = 0; i < sHookedBehaviorsCount; i++) { for (int i = 0; i < sHookedExclamationBoxesCount; i++) {
struct LuaHookedExclamationBox* hook = &sHookedExclamationBoxes[i]; struct LuaHookedExclamationBox* hook = &sHookedExclamationBoxes[i];
// Push 2 potential callbacks // Push 2 potential callbacks
@ -1840,9 +1840,9 @@ struct Object* smlua_call_exclamation_box_hook(struct Object* obj, bool write) {
// output the return value // output the return value
struct Object* returnObject = NULL; struct Object* returnObject = NULL;
if (write) { if (write && reference != 0) {
returnObject = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); returnObject = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
if (!gSmLuaConvertSuccess || returnObject == NULL) { if (lua_type(L, 1) != LUA_TTABLE || !gSmLuaConvertSuccess) {
LOG_LUA("Return value type is invalid for writeFunction: %d", lua_type(L, 1)); LOG_LUA("Return value type is invalid for writeFunction: %d", lua_type(L, 1));
continue; continue;
} }