MCPcopy Create free account
hub / github.com/DFHack/dfhack / newupvalue

Function newupvalue

depends/lua/src/lparser.c:228–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226
227
228static int newupvalue (FuncState *fs, TString *name, expdesc *v) {
229 Proto *f = fs->f;
230 int oldsize = f->sizeupvalues;
231 checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues");
232 luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues,
233 Upvaldesc, MAXUPVAL, "upvalues");
234 while (oldsize < f->sizeupvalues)
235 f->upvalues[oldsize++].name = NULL;
236 f->upvalues[fs->nups].instack = (v->k == VLOCAL);
237 f->upvalues[fs->nups].idx = cast_byte(v->u.info);
238 f->upvalues[fs->nups].name = name;
239 luaC_objbarrier(fs->ls->L, f, name);
240 return fs->nups++;
241}
242
243
244static int searchvar (FuncState *fs, TString *n) {

Callers 2

singlevarauxFunction · 0.85
mainfuncFunction · 0.85

Calls 1

checklimitFunction · 0.85

Tested by

no test coverage detected