Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
}