** Find a variable with the given name 'n', handling global variables ** too. */
| 442 | ** too. |
| 443 | */ |
| 444 | static void singlevar (LexState *ls, expdesc *var) { |
| 445 | TString *varname = str_checkname(ls); |
| 446 | FuncState *fs = ls->fs; |
| 447 | singlevaraux(fs, varname, var, 1); |
| 448 | if (var->k == VVOID) { /* global name? */ |
| 449 | expdesc key; |
| 450 | singlevaraux(fs, ls->envn, var, 1); /* get environment variable */ |
| 451 | lua_assert(var->k != VVOID); /* this one must exist */ |
| 452 | codestring(&key, varname); /* key is variable name */ |
| 453 | luaK_indexed(fs, var, &key); /* env[varname] */ |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | |
| 458 | /* |
no test coverage detected