From 5a1c8d8ef343bf0157851a4832c2c937b812b64f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 27 Jun 2017 15:32:49 -0300 Subject: new constant 'LUA_GNAME' for the name of the global table "_G" --- lauxlib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lauxlib.c') diff --git a/lauxlib.c b/lauxlib.c index 2d16c9ce..2c261077 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -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 */ } -- cgit v1.2.3-55-g6feb