Skip to content

Commit

Permalink
???
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelIT7 committed Apr 5, 2024
1 parent 0714fab commit 4286660
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions source/lua_ILuaInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ LUA_FUNCTION(ILuaInterface_Unlock)

void RunHook(GarrysMod::Lua::ILuaInterface* LUA, const char* name, ILuaValue* args)
{
const char* error = nullptr;
LUA->PushSpecial(GarrysMod::Lua::SPECIAL_GLOB);
LUA->GetField(-1, "hook");
if (LUA->IsType(-1, GarrysMod::Lua::Type::Table))
Expand Down Expand Up @@ -568,20 +569,20 @@ void RunHook(GarrysMod::Lua::ILuaInterface* LUA, const char* name, ILuaValue* ar
{
std::string err_msg = "hook.Run had an Internal error. Report this please";
err_msg = err_msg + "(" + name + ")";
LUA->ThrowError(err_msg.c_str());
Msg(err_msg.c_str());
}
SafeDelete(args);
} else {
LUA->Pop(1);
SafeDelete(args);
LUA->ThrowError("hook.Run is missing or not a function!");
error = "hook.Run is missing or not a function!";
}
LUA->Pop(2);
} else {
LUA->Pop(2);
SafeDelete(args);
LUA->ThrowError("hook table is missing or not a table!");
error = "hook table is missing or not a table!";
}

LUA->Pop(2);
SafeDelete(args);
if (error)
LUA->ThrowError(error);
}

LUA_FUNCTION(ILuaInterface_RunHook)
Expand Down

0 comments on commit 4286660

Please sign in to comment.