diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-03-27 15:00:13 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-03-27 15:00:13 -0300 |
| commit | c371413530a1bd432f4478e6e21299d7b8b35205 (patch) | |
| tree | e6efc23b8cf14141c38ba0cd5f99af72f1a78c98 | |
| parent | d1f220217beadc102a8d44b8e930a92a9f54b001 (diff) | |
| download | lua-c371413530a1bd432f4478e6e21299d7b8b35205.tar.gz lua-c371413530a1bd432f4478e6e21299d7b8b35205.tar.bz2 lua-c371413530a1bd432f4478e6e21299d7b8b35205.zip | |
small bug if LUA_USERINIT leaves garbage on the stack
| -rw-r--r-- | lua.c | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.77 2002/02/14 22:23:43 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.78 2002/02/15 15:15:10 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 | */ |
| @@ -243,6 +243,7 @@ static int lcall (lua_State *l, const char *name) { | |||
| 243 | 243 | ||
| 244 | static void manual_input (int version) { | 244 | static void manual_input (int version) { |
| 245 | if (version) print_version(); | 245 | if (version) print_version(); |
| 246 | lua_settop(L, 0); | ||
| 246 | lua_pushcfunction(L, trap_eof); /* set up handler for incomplete lines */ | 247 | lua_pushcfunction(L, trap_eof); /* set up handler for incomplete lines */ |
| 247 | while (load_string()) { | 248 | while (load_string()) { |
| 248 | ldo(lcall, NULL, 0); | 249 | ldo(lcall, NULL, 0); |
| @@ -255,7 +256,7 @@ static void manual_input (int version) { | |||
| 255 | lua_settop(L, 1); /* remove eventual results */ | 256 | lua_settop(L, 1); /* remove eventual results */ |
| 256 | } | 257 | } |
| 257 | printf("\n"); | 258 | printf("\n"); |
| 258 | lua_settop(L, 0); /* remove trap_eof */ | 259 | lua_pop(L, 1); /* remove trap_eof */ |
| 259 | } | 260 | } |
| 260 | 261 | ||
| 261 | 262 | ||
