diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-09-07 16:21:39 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-09-07 16:21:39 -0300 |
| commit | 0df2238063f3e5b1a12c5272484f2afd45a2a2f1 (patch) | |
| tree | 04361bb15edb5dbeba28ecd0103a0f29807112ad /lparser.c | |
| parent | 6828f6d42786de735d6696da8cccbb47c8bad347 (diff) | |
| download | lua-0df2238063f3e5b1a12c5272484f2afd45a2a2f1.tar.gz lua-0df2238063f3e5b1a12c5272484f2afd45a2a2f1.tar.bz2 lua-0df2238063f3e5b1a12c5272484f2afd45a2a2f1.zip | |
name "_ENV" configurable through 'luaconf.h'
Diffstat (limited to 'lparser.c')
| -rw-r--r-- | lparser.c | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.c,v 2.90 2010/07/07 16:27:29 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.91 2010/08/23 17:32:34 roberto Exp roberto $ |
| 3 | ** Lua Parser | 3 | ** Lua Parser |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -289,7 +289,7 @@ static void singlevar (LexState *ls, expdesc *var) { | |||
| 289 | FuncState *fs = ls->fs; | 289 | FuncState *fs = ls->fs; |
| 290 | if (singlevaraux(fs, varname, var, 1) == VVOID) { /* global name? */ | 290 | if (singlevaraux(fs, varname, var, 1) == VVOID) { /* global name? */ |
| 291 | expdesc key; | 291 | expdesc key; |
| 292 | singlevaraux(fs, ls->envn, var, 1); /* get _ENV variable */ | 292 | singlevaraux(fs, ls->envn, var, 1); /* get environment variable */ |
| 293 | lua_assert(var->k == VLOCAL || var->k == VUPVAL); | 293 | lua_assert(var->k == VLOCAL || var->k == VUPVAL); |
| 294 | codestring(ls, &key, varname); /* key is variable name */ | 294 | codestring(ls, &key, varname); /* key is variable name */ |
| 295 | luaK_indexed(fs, var, &key); /* env[varname] */ | 295 | luaK_indexed(fs, var, &key); /* env[varname] */ |
| @@ -433,14 +433,14 @@ static void close_func (LexState *ls) { | |||
| 433 | 433 | ||
| 434 | /* | 434 | /* |
| 435 | ** opens the main function, which is a regular vararg function with an | 435 | ** opens the main function, which is a regular vararg function with an |
| 436 | ** upvalue named '_ENV' | 436 | ** upvalue named LUA_ENV |
| 437 | */ | 437 | */ |
| 438 | static void open_mainfunc (LexState *ls, FuncState *fs) { | 438 | static void open_mainfunc (LexState *ls, FuncState *fs) { |
| 439 | expdesc v; | 439 | expdesc v; |
| 440 | open_func(ls, fs); | 440 | open_func(ls, fs); |
| 441 | fs->f->is_vararg = 1; /* main function is always vararg */ | 441 | fs->f->is_vararg = 1; /* main function is always vararg */ |
| 442 | init_exp(&v, VLOCAL, 0); | 442 | init_exp(&v, VLOCAL, 0); |
| 443 | newupvalue(fs, ls->envn, &v); /* create '_ENV' upvalue */ | 443 | newupvalue(fs, ls->envn, &v); /* create environment upvalue */ |
| 444 | } | 444 | } |
| 445 | 445 | ||
| 446 | 446 | ||
