diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-08-25 12:39:16 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-08-25 12:39:16 -0300 |
commit | 39cdbce23edfd443699e396900a70de3fcff46c7 (patch) | |
tree | 821660333387a4afb34c699763f72832ef384804 /lua.c | |
parent | 8974b59e4014dd1ca79dec6994d4c53ac226de5f (diff) | |
download | lua-39cdbce23edfd443699e396900a70de3fcff46c7.tar.gz lua-39cdbce23edfd443699e396900a70de3fcff46c7.tar.bz2 lua-39cdbce23edfd443699e396900a70de3fcff46c7.zip |
no more '-w' option + new way to check module existence
Diffstat (limited to 'lua.c')
-rw-r--r-- | lua.c | 18 |
1 files changed, 1 insertions, 17 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.145 2005/06/03 20:16:16 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.146 2005/06/28 13:01:50 roberto Exp roberto $ |
3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -48,7 +48,6 @@ static void print_usage (void) { | |||
48 | " -i enter interactive mode after executing " LUA_QL("script") "\n" | 48 | " -i enter interactive mode after executing " LUA_QL("script") "\n" |
49 | " -l name require library " LUA_QL("name") "\n" | 49 | " -l name require library " LUA_QL("name") "\n" |
50 | " -v show version information\n" | 50 | " -v show version information\n" |
51 | " -w trap access to undefined globals\n" | ||
52 | " -- stop handling options\n" , | 51 | " -- stop handling options\n" , |
53 | progname); | 52 | progname); |
54 | } | 53 | } |
@@ -223,14 +222,6 @@ static void dotty (lua_State *L) { | |||
223 | } | 222 | } |
224 | 223 | ||
225 | 224 | ||
226 | static int checkvar (lua_State *L) { | ||
227 | const char *name = lua_tostring(L, 2); | ||
228 | if (name) | ||
229 | luaL_error(L, "attempt to access undefined variable " LUA_QS, name); | ||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | |||
234 | #define clearinteractive(i) (*i &= 2) | 225 | #define clearinteractive(i) (*i &= 2) |
235 | 226 | ||
236 | static int handle_argv (lua_State *L, int argc, char **argv, int *interactive) { | 227 | static int handle_argv (lua_State *L, int argc, char **argv, int *interactive) { |
@@ -268,13 +259,6 @@ static int handle_argv (lua_State *L, int argc, char **argv, int *interactive) { | |||
268 | print_version(); | 259 | print_version(); |
269 | break; | 260 | break; |
270 | } | 261 | } |
271 | case 'w': { | ||
272 | if (lua_getmetatable(L, LUA_GLOBALSINDEX)) { | ||
273 | lua_pushcfunction(L, checkvar); | ||
274 | lua_setfield(L, -2, "__index"); | ||
275 | } | ||
276 | break; | ||
277 | } | ||
278 | case 'e': { | 262 | case 'e': { |
279 | const char *chunk = argv[i] + 2; | 263 | const char *chunk = argv[i] + 2; |
280 | clearinteractive(interactive); | 264 | clearinteractive(interactive); |