diff options
Diffstat (limited to 'lundump.c')
| -rw-r--r-- | lundump.c | 13 |
1 files changed, 5 insertions, 8 deletions
| @@ -392,7 +392,8 @@ static void checkHeader (LoadState *S) { | |||
| 392 | /* | 392 | /* |
| 393 | ** Load precompiled chunk. | 393 | ** Load precompiled chunk. |
| 394 | */ | 394 | */ |
| 395 | LClosure *luaU_undump (lua_State *L, ZIO *Z, const char *name, int fixed) { | 395 | LClosure *luaU_undump (lua_State *L, ZIO *Z, Table *anchor, const char *name, |
| 396 | int fixed) { | ||
| 396 | LoadState S; | 397 | LoadState S; |
| 397 | LClosure *cl; | 398 | LClosure *cl; |
| 398 | if (*name == '@' || *name == '=') | 399 | if (*name == '@' || *name == '=') |
| @@ -405,20 +406,16 @@ LClosure *luaU_undump (lua_State *L, ZIO *Z, const char *name, int fixed) { | |||
| 405 | S.fixed = cast_byte(fixed); | 406 | S.fixed = cast_byte(fixed); |
| 406 | S.offset = 1; /* fist byte was already read */ | 407 | S.offset = 1; /* fist byte was already read */ |
| 407 | checkHeader(&S); | 408 | checkHeader(&S); |
| 408 | cl = luaF_newLclosure(L, loadByte(&S)); | 409 | S.h = anchor; |
| 409 | setclLvalue2s(L, L->top.p, cl); | ||
| 410 | luaD_inctop(L); | ||
| 411 | S.h = luaH_new(L); /* create list of saved strings */ | ||
| 412 | S.nstr = 0; | 410 | S.nstr = 0; |
| 413 | sethvalue2s(L, L->top.p, S.h); /* anchor it */ | 411 | cl = luaF_newLclosure(L, loadByte(&S)); |
| 414 | luaD_inctop(L); | 412 | luaD_anchorobj(L, anchor, obj2gco(cl)); |
| 415 | cl->p = luaF_newproto(L); | 413 | cl->p = luaF_newproto(L); |
| 416 | luaC_objbarrier(L, cl, cl->p); | 414 | luaC_objbarrier(L, cl, cl->p); |
| 417 | loadFunction(&S, cl->p); | 415 | loadFunction(&S, cl->p); |
| 418 | if (cl->nupvalues != cl->p->sizeupvalues) | 416 | if (cl->nupvalues != cl->p->sizeupvalues) |
| 419 | error(&S, "corrupted chunk"); | 417 | error(&S, "corrupted chunk"); |
| 420 | luai_verifycode(L, cl->p); | 418 | luai_verifycode(L, cl->p); |
| 421 | L->top.p--; /* pop table */ | ||
| 422 | return cl; | 419 | return cl; |
| 423 | } | 420 | } |
| 424 | 421 | ||
