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

Function searchvar

extlibs/lua/src/lparser.c:382–395  ·  view source on GitHub ↗

** Look for an active local variable with the name 'n' in the ** function 'fs'. */

Source from the content-addressed store, hash-verified

380** function 'fs'.
381*/
382static int searchvar (FuncState *fs, TString *n, expdesc *var) {
383 int i;
384 for (i = cast_int(fs->nactvar) - 1; i >= 0; i--) {
385 Vardesc *vd = getlocalvardesc(fs, i);
386 if (eqstr(n, vd->vd.name)) { /* found? */
387 if (vd->vd.kind == RDKCTC) /* compile-time constant? */
388 init_exp(var, VCONST, fs->firstlocal + i);
389 else /* real variable */
390 init_var(fs, var, i);
391 return var->k;
392 }
393 }
394 return -1; /* not found */
395}
396
397
398/*

Callers 1

singlevarauxFunction · 0.85

Calls 3

getlocalvardescFunction · 0.85
init_expFunction · 0.85
init_varFunction · 0.85

Tested by

no test coverage detected