new constant 'LUA_GNAME' for the name of the global table "_G"
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp roberto $
|
||||
** $Id: lauxlib.c,v 1.290 2017/04/24 18:06:12 roberto Exp roberto $
|
||||
** Auxiliary functions for building Lua libraries
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ static int pushglobalfuncname (lua_State *L, lua_Debug *ar) {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
|
||||
if (findfield(L, top + 1, 2)) {
|
||||
const char *name = lua_tostring(L, -1);
|
||||
if (strncmp(name, "_G.", 3) == 0) { /* name start with '_G.'? */
|
||||
if (strncmp(name, LUA_GNAME ".", 3) == 0) { /* name start with '_G.'? */
|
||||
lua_pushstring(L, name + 3); /* push name without prefix */
|
||||
lua_remove(L, -2); /* remove original name */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user