** Find a variable with the given name 'n', handling global variables ** too. */
| 450 | ** too. |
| 451 | */ |
| 452 | static 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 | /* |
no test coverage detected