- Avoid fixing name "_ENV" in the code
- Small improvements in the manual
This commit is contained in:
Roberto I 2025-12-08 13:09:47 -03:00
parent 8164d09338
commit 104b0fc700
2 changed files with 8 additions and 8 deletions

View file

@ -505,8 +505,8 @@ static void buildglobal (LexState *ls, TString *varname, expdesc *var) {
init_exp(var, VGLOBAL, -1); /* global by default */ init_exp(var, VGLOBAL, -1); /* global by default */
singlevaraux(fs, ls->envn, var, 1); /* get environment variable */ singlevaraux(fs, ls->envn, var, 1); /* get environment variable */
if (var->k == VGLOBAL) if (var->k == VGLOBAL)
luaK_semerror(ls, "_ENV is global when accessing variable '%s'", luaK_semerror(ls, "%s is global when accessing variable '%s'",
getstr(varname)); LUA_ENV, getstr(varname));
luaK_exp2anyregup(fs, var); /* _ENV could be a constant */ luaK_exp2anyregup(fs, var); /* _ENV could be a constant */
codestring(&key, varname); /* key is variable name */ codestring(&key, varname); /* key is variable name */
luaK_indexed(fs, var, &key); /* 'var' represents _ENV[varname] */ luaK_indexed(fs, var, &key); /* 'var' represents _ENV[varname] */

View file

@ -107,7 +107,7 @@ for small machines and embedded systems.
Unless stated otherwise, Unless stated otherwise,
any overflow when manipulating integer values @def{wrap around}, any overflow when manipulating integer values @def{wrap around},
according to the usual rules of two-complement arithmetic. according to the usual rules of two's complement arithmetic.
(In other words, (In other words,
the actual result is the unique representable integer the actual result is the unique representable integer
that is equal modulo @M{2@sp{n}} to the mathematical result, that is equal modulo @M{2@sp{n}} to the mathematical result,
@ -2458,7 +2458,7 @@ for instance @T{{e1, e2, e3}} @see{tableconstructor}.}
for instance @T{foo(e1, e2, e3)} @see{functioncall}.} for instance @T{foo(e1, e2, e3)} @see{functioncall}.}
@item{A multiple assignment, @item{A multiple assignment,
for instance @T{a , b, c = e1, e2, e3} @see{assignment}.} for instance @T{a, b, c = e1, e2, e3} @see{assignment}.}
@item{A local or global declaration, @item{A local or global declaration,
which is similar to a multiple assignment.} which is similar to a multiple assignment.}
@ -3640,9 +3640,9 @@ because a pseudo-index is not an actual stack position.
The type of integers in Lua. The type of integers in Lua.
By default this type is @id{long long}, By default this type is @id{long long},
(usually a 64-bit two-complement integer), (usually a 64-bit two's complement integer),
but that can be changed to @id{long} or @id{int} but that can be changed to @id{long} or @id{int}
(usually a 32-bit two-complement integer). (usually a 32-bit two's complement integer).
(See @id{LUA_INT_TYPE} in @id{luaconf.h}.) (See @id{LUA_INT_TYPE} in @id{luaconf.h}.)
Lua also defines the constants Lua also defines the constants
@ -5439,7 +5439,7 @@ the auxiliary library provides higher-level functions for some
common tasks. common tasks.
All functions and types from the auxiliary library All functions and types from the auxiliary library
are defined in header file @id{lauxlib.h} and are defined in the header file @id{lauxlib.h} and
have a prefix @id{luaL_}. have a prefix @id{luaL_}.
All functions in the auxiliary library are built on All functions in the auxiliary library are built on
@ -6492,7 +6492,7 @@ the host program can call the function @Lid{luaL_openlibs}.
Alternatively, Alternatively,
the host can select which libraries to open, the host can select which libraries to open,
by using @Lid{luaL_openselectedlibs}. by using @Lid{luaL_openselectedlibs}.
Both functions are defined in the header file @id{lualib.h}. Both functions are declared in the header file @id{lualib.h}.
@index{lualib.h} @index{lualib.h}
The stand-alone interpreter @id{lua} @see{lua-sa} The stand-alone interpreter @id{lua} @see{lua-sa}