diff options
| -rw-r--r-- | ldump.c | 3 | ||||
| -rw-r--r-- | lundump.c | 12 |
2 files changed, 5 insertions, 10 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldump.c,v 2.19 2013/04/26 18:48:35 roberto Exp roberto $ | 2 | ** $Id: ldump.c,v 2.20 2014/02/27 16:56:20 roberto Exp roberto $ |
| 3 | ** save precompiled Lua chunks | 3 | ** save precompiled Lua chunks |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -184,6 +184,7 @@ int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip | |||
| 184 | D.strip=strip; | 184 | D.strip=strip; |
| 185 | D.status=0; | 185 | D.status=0; |
| 186 | DumpHeader(&D); | 186 | DumpHeader(&D); |
| 187 | DumpChar(f->sizeupvalues,&D); | ||
| 187 | DumpFunction(f,&D); | 188 | DumpFunction(f,&D); |
| 188 | return D.status; | 189 | return D.status; |
| 189 | } | 190 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lundump.c,v 2.25 2014/02/13 12:11:34 roberto Exp roberto $ | 2 | ** $Id: lundump.c,v 2.26 2014/02/27 16:56:20 roberto Exp roberto $ |
| 3 | ** load precompiled Lua chunks | 3 | ** load precompiled Lua chunks |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -238,17 +238,11 @@ Closure* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) | |||
| 238 | S.Z=Z; | 238 | S.Z=Z; |
| 239 | S.b=buff; | 239 | S.b=buff; |
| 240 | checkHeader(&S); | 240 | checkHeader(&S); |
| 241 | cl=luaF_newLclosure(L,1); | 241 | cl=luaF_newLclosure(L,LoadByte(&S)); |
| 242 | setclLvalue(L,L->top,cl); incr_top(L); | 242 | setclLvalue(L,L->top,cl); incr_top(L); |
| 243 | cl->l.p=luaF_newproto(L); | 243 | cl->l.p=luaF_newproto(L); |
| 244 | LoadFunction(&S,cl->l.p); | 244 | LoadFunction(&S,cl->l.p); |
| 245 | if (cl->l.p->sizeupvalues != 1) | 245 | lua_assert(cl->l.nupvalues==cl->l.p->sizeupvalues); |
| 246 | { | ||
| 247 | Proto* p=cl->l.p; | ||
| 248 | cl=luaF_newLclosure(L,cl->l.p->sizeupvalues); | ||
| 249 | cl->l.p=p; | ||
| 250 | setclLvalue(L,L->top-1,cl); | ||
| 251 | } | ||
| 252 | luai_verifycode(L,buff,cl->l.p); | 246 | luai_verifycode(L,buff,cl->l.p); |
| 253 | return cl; | 247 | return cl; |
| 254 | } | 248 | } |
