diff options
Diffstat (limited to 'lua.stx')
-rw-r--r-- | lua.stx | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -1,6 +1,6 @@ %{ /* -** $Id: lua.stx,v 1.21 1997/12/09 13:35:19 roberto Exp roberto $ +** $Id: lua.stx,v 1.22 1997/12/09 16:01:08 roberto Exp roberto $ ** Syntax analizer and code generator ** See Copyright Notice in lua.h */ @@ -555,10 +555,14 @@ static void func_onstack (TProtoFunc *f) int c = next_constant(L->currState); ttype(&L->currState->f->consts[c]) = LUA_T_PROTO; L->currState->f->consts[c].value.tf = (L->currState+1)->f; - for (i=0; i<nupvalues; i++) - lua_pushvar((L->currState+1)->upvalues[i]); - code_constant(c); - code_oparg(CLOSURE, 2, nupvalues, -nupvalues); + if (nupvalues == 0) + code_constant(c); + else { + for (i=0; i<nupvalues; i++) + lua_pushvar((L->currState+1)->upvalues[i]); + code_constant(c); + code_oparg(CLOSURE, 2, nupvalues, -nupvalues); + } } |