diff options
author | Lua Team <team@lua.org> | 2014-12-16 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2014-12-16 12:00:00 +0000 |
commit | 514a0c89db308fafb79ee7cbfad11f74fcf3f652 (patch) | |
tree | 42ed73648b929eab864188e09024c64736f91e54 /src | |
parent | fd9a52f7ff522a363ff2495d33b331c221981d60 (diff) | |
download | lua-github-5.3.0-rc1.tar.gz |
Lua 5.3.0-rc15.3.0-rc1
Diffstat (limited to 'src')
-rw-r--r-- | src/lauxlib.c | 13 | ||||
-rw-r--r-- | src/luaconf.h | 53 |
2 files changed, 38 insertions, 28 deletions
diff --git a/src/lauxlib.c b/src/lauxlib.c index 2387141b..1c41d6a8 100644 --- a/src/lauxlib.c +++ b/src/lauxlib.c @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.277 2014/12/10 11:31:32 roberto Exp $ +** $Id: lauxlib.c,v 1.279 2014/12/14 18:32:26 roberto Exp $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -66,11 +66,20 @@ static int findfield (lua_State *L, int objidx, int level) { } +/* +** Search for a name for a function in all loaded modules +** (registry._LOADED). +*/ static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { int top = lua_gettop(L); lua_getinfo(L, "f", ar); /* push function */ - lua_pushglobaltable(L); + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); if (findfield(L, top + 1, 2)) { + const char *name = lua_tostring(L, -1); + if (strncmp(name, "_G.", 3) == 0) { /* name start with '_G.'? */ + lua_pushstring(L, name + 3); /* push name without prefix */ + lua_remove(L, -2); /* remove original name */ + } lua_copy(L, -1, top + 1); /* move name to proper place */ lua_pop(L, 2); /* remove pushed values */ return 1; diff --git a/src/luaconf.h b/src/luaconf.h index 593ccd8d..f470f0eb 100644 --- a/src/luaconf.h +++ b/src/luaconf.h @@ -1,12 +1,12 @@ /* -** $Id: luaconf.h,v 1.231 2014/12/10 11:56:55 roberto Exp $ +** $Id: luaconf.h,v 1.235 2014/12/16 17:17:30 roberto Exp $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ -#ifndef lconfig_h -#define lconfig_h +#ifndef luaconf_h +#define luaconf_h #include <limits.h> #include <stddef.h> @@ -20,18 +20,18 @@ /* -** {================================================================== +** {==================================================================== ** System Configuration: macros to adapt (if needed) Lua to some -** particular platform, for instance compiling it as Small Lua (32 -** bits) or restricting it to C89. -** =================================================================== +** particular platform, for instance compiling it with 32-bit numbers or +** restricting it to C89. +** ===================================================================== */ /* -@@ LUA_32BITS enables Small Lua (that is, Lua with 32-bit integers -** and 32-bit floats). You can also define LUA_32BITS in the make file, -** but changing here you ensure that all software connected to Lua will -** be compiled with the same configuration. +@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You +** can also define LUA_32BITS in the make file, but changing here you +** ensure that all software connected to Lua will be compiled with the +** same configuration. */ /* #define LUA_32BITS */ @@ -74,8 +74,8 @@ /* @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for -** C89 ('long' and 'double'); Windows has '__int64', so it does not need -** to use this case. +** C89 ('long' and 'double'); Windows always has '__int64', so it does +** not need to use this case. */ #if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) #define LUA_C89_NUMBERS @@ -102,8 +102,8 @@ ** the type for Lua floats. ** Lua should work fine with any mix of these options (if supported ** by your C compiler). The usual configurations are 64-bit integers -** and 'double' (the default), 32-bit integers and 'float' (Small Lua, -** for restricted platforms), and 'long'/'double' (for C compilers not +** and 'double' (the default), 32-bit integers and 'float' (for +** restricted platforms), and 'long'/'double' (for C compilers not ** compliant with C99, which may not have support for 'long long'). */ @@ -127,8 +127,7 @@ #else /* }{ */ /* -** default configuration for 64-bit Lua ('long long' and 'double'); -** Windows will use '__int64' +** default configuration for 64-bit Lua ('long long' and 'double') */ #define LUA_INT_LONGLONG #define LUA_REAL_DOUBLE @@ -565,7 +564,17 @@ #elif defined(LUA_INT_LONGLONG) /* }{ long long */ -#if defined(LUA_USE_WINDOWS) /* { */ +#if defined(LLONG_MAX) /* { */ +/* use ISO C99 stuff */ + +#define LUA_INTEGER long long +#define LUA_INTEGER_FRMLEN "ll" + +#define LUA_MAXINTEGER LLONG_MAX +#define LUA_MININTEGER LLONG_MIN + +#elif defined(LUA_USE_WINDOWS) /* }{ */ +/* in Windows, can use specific Windows types */ #define LUA_INTEGER __int64 #define LUA_INTEGER_FRMLEN "I64" @@ -575,16 +584,8 @@ #else /* }{ */ -#if !defined(LLONG_MAX) #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" -#endif - -#define LUA_INTEGER long long -#define LUA_INTEGER_FRMLEN "ll" - -#define LUA_MAXINTEGER LLONG_MAX -#define LUA_MININTEGER LLONG_MIN #endif /* } */ |