Closure *luaF_newclosure(int32 nelems) { Closure *c = (Closure *)luaM_malloc(sizeof(Closure) + nelems * sizeof(TObject)); luaO_insertlist(&rootcl, (GCnode *)c); nblocks += gcsizeclosure(c); c->nelems = nelems; return c; }
Hash *luaH_new(int32 nhash) { Hash *t = luaM_new(Hash); nhash = luaO_redimension((int32)((float)nhash / REHASH_LIMIT)); nodevector(t) = hashnodecreate(nhash); nhash(t) = nhash; nuse(t) = 0; t->htag = TagDefault; luaO_insertlist(&roottable, (GCnode *)t); nblocks += gcsize(nhash); return t; }
TProtoFunc *luaF_newproto() { TProtoFunc *f = luaM_new(TProtoFunc); f->code = nullptr; f->lineDefined = 0; f->fileName = nullptr; f->consts = nullptr; f->nconsts = 0; f->locvars = nullptr; luaO_insertlist(&rootproto, (GCnode *)f); nblocks += gcsizeproto(f); return f; }