diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-06-27 15:32:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-06-27 15:32:49 -0300 |
commit | 5a1c8d8ef343bf0157851a4832c2c937b812b64f (patch) | |
tree | 61948343a233dae64a1d02b7c77b00f5b7eba6da /lauxlib.c | |
parent | 124bfd20817d4624d2b69a4dc41182485912b821 (diff) | |
download | lua-5a1c8d8ef343bf0157851a4832c2c937b812b64f.tar.gz lua-5a1c8d8ef343bf0157851a4832c2c937b812b64f.tar.bz2 lua-5a1c8d8ef343bf0157851a4832c2c937b812b64f.zip |
new constant 'LUA_GNAME' for the name of the global table "_G"
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.290 2017/04/24 18:06:12 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -76,7 +76,7 @@ static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { | |||
76 | lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); | 76 | lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); |
77 | if (findfield(L, top + 1, 2)) { | 77 | if (findfield(L, top + 1, 2)) { |
78 | const char *name = lua_tostring(L, -1); | 78 | const char *name = lua_tostring(L, -1); |
79 | if (strncmp(name, "_G.", 3) == 0) { /* name start with '_G.'? */ | 79 | if (strncmp(name, LUA_GNAME ".", 3) == 0) { /* name start with '_G.'? */ |
80 | lua_pushstring(L, name + 3); /* push name without prefix */ | 80 | lua_pushstring(L, name + 3); /* push name without prefix */ |
81 | lua_remove(L, -2); /* remove original name */ | 81 | lua_remove(L, -2); /* remove original name */ |
82 | } | 82 | } |