MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / singlevar

Function singlevar

lib/lua/src/lparser.c:463–475  ·  view source on GitHub ↗

** Find a variable with the given name 'n', handling global variables ** too. */

Source from the content-addressed store, hash-verified

461** too.
462*/
463static void singlevar (LexState *ls, expdesc *var) {
464 TString *varname = str_checkname(ls);
465 FuncState *fs = ls->fs;
466 singlevaraux(fs, varname, var, 1);
467 if (var->k == VVOID) { /* global name? */
468 expdesc key;
469 singlevaraux(fs, ls->envn, var, 1); /* get environment variable */
470 lua_assert(var->k != VVOID); /* this one must exist */
471 luaK_exp2anyregup(fs, var); /* but could be a constant */
472 codestring(&key, varname); /* key is variable name */
473 luaK_indexed(fs, var, &key); /* env[varname] */
474 }
475}
476
477
478/*

Callers 2

primaryexpFunction · 0.85
funcnameFunction · 0.85

Calls 5

str_checknameFunction · 0.85
singlevarauxFunction · 0.85
luaK_exp2anyregupFunction · 0.85
codestringFunction · 0.85
luaK_indexedFunction · 0.85

Tested by

no test coverage detected