MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / new_localvar

Function new_localvar

extlibs/lua/src/lparser.c:193–206  ·  view source on GitHub ↗

** Create a new local variable with the given 'name'. Return its index ** in the function. */

Source from the content-addressed store, hash-verified

191** in the function.
192*/
193static int new_localvar (LexState *ls, TString *name) {
194 lua_State *L = ls->L;
195 FuncState *fs = ls->fs;
196 Dyndata *dyd = ls->dyd;
197 Vardesc *var;
198 checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal,
199 MAXVARS, "local variables");
200 luaM_growvector(L, dyd->actvar.arr, dyd->actvar.n + 1,
201 dyd->actvar.size, Vardesc, USHRT_MAX, "local variables");
202 var = &dyd->actvar.arr[dyd->actvar.n++];
203 var->vd.kind = VDKREG; /* default */
204 var->vd.name = name;
205 return dyd->actvar.n - 1 - fs->firstlocal;
206}
207
208#define new_localvarliteral(ls,v) \
209 new_localvar(ls, \

Callers 5

parlistFunction · 0.85
fornumFunction · 0.85
forlistFunction · 0.85
localfuncFunction · 0.85
localstatFunction · 0.85

Calls 1

checklimitFunction · 0.85

Tested by

no test coverage detected