MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / singlevar

Function singlevar

3rd/lua-5.4.3/src/lparser.c:452–463  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

450** too.
451*/
452static void singlevar (LexState *ls, expdesc *var) {
453 TString *varname = str_checkname(ls);
454 FuncState *fs = ls->fs;
455 singlevaraux(fs, varname, var, 1);
456 if (var->k == VVOID) { /* global name? */
457 expdesc key;
458 singlevaraux(fs, ls->envn, var, 1); /* get environment variable */
459 lua_assert(var->k != VVOID); /* this one must exist */
460 codestring(&key, varname); /* key is variable name */
461 luaK_indexed(fs, var, &key); /* env[varname] */
462 }
463}
464
465
466/*

Callers 2

primaryexpFunction · 0.85
funcnameFunction · 0.85

Calls 4

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

Tested by

no test coverage detected