Skip to content

Commit

Permalink
Hide QueryHandle class from global environment
Browse files Browse the repository at this point in the history
  • Loading branch information
qaisjp committed Sep 13, 2015
1 parent 2500ca4 commit a731d76
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions MTA10_Server/mods/deathmatch/logic/lua/LuaCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void lua_getclass ( lua_State* luaVM, const char* szName )
}


void lua_registerclass ( lua_State* luaVM, const char* szName, const char* szParent )
void lua_registerclass ( lua_State* luaVM, const char* szName, const char* szParent, bool bRegisterWithEnvironment )
{
if ( szParent != NULL )
{
Expand All @@ -381,9 +381,10 @@ void lua_registerclass ( lua_State* luaVM, const char* szName, const char* szPar

lua_pop ( luaVM, 1 );

// register with environment
lua_getfield ( luaVM, -1, "__class" );
lua_setglobal ( luaVM, szName );
if ( bRegisterWithEnvironment ) {
lua_getfield ( luaVM, -1, "__class" );
lua_setglobal ( luaVM, szName );
}

lua_pop ( luaVM, 1 );
}
Expand Down
2 changes: 1 addition & 1 deletion MTA10_Server/mods/deathmatch/logic/lua/LuaCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void lua_initclasses ( lua_State* luaVM );

void lua_newclass ( lua_State* luaVM );
void lua_getclass ( lua_State* luaVM, const char* szName );
void lua_registerclass ( lua_State* luaVM, const char* szName, const char* szParent = NULL );
void lua_registerclass ( lua_State* luaVM, const char* szName, const char* szParent = NULL, bool bRegisterWithEnvironment = true);
void lua_registerstaticclass ( lua_State* luaVM, const char* szName );
void lua_classfunction ( lua_State* luaVM, const char* szFunction, const char* szACLName, lua_CFunction fn );
void lua_classfunction ( lua_State* luaVM, const char* szFunction, const char* fn );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void CLuaDatabaseDefs::AddClass ( lua_State* luaVM )
lua_classfunction ( luaVM, "poll", "dbPoll" );
lua_classfunction ( luaVM, "free", "dbFree" );

lua_registerclass ( luaVM, "QueryHandle" );
lua_registerclass ( luaVM, "QueryHandle", NULL, false );
//////////////////////////
}

Expand Down

0 comments on commit a731d76

Please sign in to comment.