MySQL connection module for Garry's Mod servers - SUP has picked up and maintained the module since it was abandoned years ago - Original author: @bkacjios
While not crucial I found a function thats leaking the Lua stack.
void DatabaseAction::TriggerCallback(lua_State* state);
The LUA->ReferencePush(tmysql::iRefDebugTraceBack); does not get cleaned up with a LUA->Pop(); PCall does not clean it up by itself.
You should also consider doing this in that function:
Right before the PCallint count = LUA->Top();
Then change the PCall to LUA->PCall( count - 2, 0, -count )
This allows you to remove the int args = 1;
Though this entire thing does not work if your LUA->Top(); does not start with 0. Then you should do int top = LUA->Top();before the LUA->ReferencePush(tmysql::iRefDebugTraceBack); and int count = LUA->Top() - top;
However this would add 1 or 2 extra calls so it might not be worth doing.
While not crucial I found a function thats leaking the Lua stack.
void DatabaseAction::TriggerCallback(lua_State* state);
TheLUA->ReferencePush(tmysql::iRefDebugTraceBack);
does not get cleaned up with aLUA->Pop();
PCall does not clean it up by itself.You should also consider doing this in that function: Right before the PCall
int count = LUA->Top();
Then change the PCall toLUA->PCall( count - 2, 0, -count )
This allows you to remove theint args = 1;
Though this entire thing does not work if your
LUA->Top();
does not start with 0. Then you should doint top = LUA->Top();
before theLUA->ReferencePush(tmysql::iRefDebugTraceBack);
andint count = LUA->Top() - top;
However this would add 1 or 2 extra calls so it might not be worth doing.