diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-06-17 11:06:52 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-06-17 11:06:52 -0300 |
| commit | dba17070ac2a6a54079b0b935635377545a3b764 (patch) | |
| tree | 57d454c3f58bb5a41dcd99c058113e443b3ed897 /lauxlib.c | |
| parent | 569eefbf73a6c41b16aa6dc2d4f1c52ebde54084 (diff) | |
| download | lua-dba17070ac2a6a54079b0b935635377545a3b764.tar.gz lua-dba17070ac2a6a54079b0b935635377545a3b764.tar.bz2 lua-dba17070ac2a6a54079b0b935635377545a3b764.zip | |
optional error for accesss to undefined variables/fields
Diffstat (limited to 'lauxlib.c')
| -rw-r--r-- | lauxlib.c | 4 |
1 files changed, 3 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.114 2004/06/02 13:50:46 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.115 2004/06/02 19:06:14 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 | */ |
| @@ -243,6 +243,8 @@ LUALIB_API void luaL_openlib (lua_State *L, const char *libname, | |||
| 243 | if (lua_isnil(L, -1)) { /* no? */ | 243 | if (lua_isnil(L, -1)) { /* no? */ |
| 244 | lua_pop(L, 1); | 244 | lua_pop(L, 1); |
| 245 | lua_newtable(L); /* create it */ | 245 | lua_newtable(L); /* create it */ |
| 246 | if (lua_getmetatable(L, LUA_GLOBALSINDEX)) | ||
| 247 | lua_setmetatable(L, -2); /* share metatable with global table */ | ||
| 246 | lua_pushvalue(L, -1); | 248 | lua_pushvalue(L, -1); |
| 247 | /* register it with given name */ | 249 | /* register it with given name */ |
| 248 | lua_setglobal(L, libname); | 250 | lua_setglobal(L, libname); |
