diff options
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.226 2003/10/03 16:04:11 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.227 2003/10/20 12:24:26 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -445,6 +445,7 @@ struct SParser { /* data to `f_parser' */ | |||
445 | }; | 445 | }; |
446 | 446 | ||
447 | static void f_parser (lua_State *L, void *ud) { | 447 | static void f_parser (lua_State *L, void *ud) { |
448 | int i; | ||
448 | Proto *tf; | 449 | Proto *tf; |
449 | Closure *cl; | 450 | Closure *cl; |
450 | struct SParser *p = cast(struct SParser *, ud); | 451 | struct SParser *p = cast(struct SParser *, ud); |
@@ -452,8 +453,10 @@ static void f_parser (lua_State *L, void *ud) { | |||
452 | luaC_checkGC(L); | 453 | luaC_checkGC(L); |
453 | tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z, | 454 | tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z, |
454 | &p->buff, p->name); | 455 | &p->buff, p->name); |
455 | cl = luaF_newLclosure(L, 0, gt(L)); | 456 | cl = luaF_newLclosure(L, tf->nups, gt(L)); |
456 | cl->l.p = tf; | 457 | cl->l.p = tf; |
458 | for (i = 0; i < tf->nups; i++) /* initialize eventual upvalues */ | ||
459 | cl->l.upvals[i] = luaF_newupval(L); | ||
457 | setclvalue(L->top, cl); | 460 | setclvalue(L->top, cl); |
458 | incr_top(L); | 461 | incr_top(L); |
459 | } | 462 | } |