int luaK_numberK (FuncState *fs, lua_Number r) { TValue o; #if LUA_REFCOUNT lua_State *L = fs->L; int ret; setnvalue2n(&o, r); ret = addk(fs, &o, &o); setnilvalue(&o); return ret; #else setnvalue(&o, r); return addk(fs, &o, &o); #endif /* LUA_REFCOUNT */ }
static void LoadConstants (LoadState* S, Proto* f) { lua_State *L = S->L; int i,n; (void)L; n=LoadInt(S); luaM_setname(S->L, "Lua_constants"); f->k=luaM_newvector(S->L,n,TObject); f->sizek=n; for (i=0; i<n; i++) { TObject* o=&f->k[i]; int t=LoadByte(S); switch (t) { case LUA_TNUMBER: setnvalue2n(o,LoadNumber(S)); break; case LUA_TSTRING: setsvalue2n(o,LoadString(S)); break; case LUA_TWSTRING: setwsvalue2n(o,LoadWString(S)); break; case LUA_TNIL: setnilvalue2n(o); break; default: luaG_runerror(S->L,"bad constant type (%d) in %s",t,S->name); break; } } n=LoadInt(S); f->p=luaM_newvector(S->L,n,Proto*); f->sizep=n; for (i=0; i<n; i++) f->p[i]=LoadFunction(S,f->source); }