diff options
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); |
