aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-10-19 16:30:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-10-19 16:30:39 -0300
commitc954db39241a8b21d7b32b42b87a066b4708f969 (patch)
tree7cae63de60ef7f3ca5f56a97a98121b8607b2f59
parent14d2803e55f0bbc2b09890a3b30afbb063ec973d (diff)
downloadlua-c954db39241a8b21d7b32b42b87a066b4708f969.tar.gz
lua-c954db39241a8b21d7b32b42b87a066b4708f969.tar.bz2
lua-c954db39241a8b21d7b32b42b87a066b4708f969.zip
Option '-l g=mod' added to the manual
Plus some other improvements in the manual.
-rw-r--r--manual/manual.of23
1 files changed, 12 insertions, 11 deletions
diff --git a/manual/manual.of b/manual/manual.of
index ade47b20..10c16bd1 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -1423,9 +1423,6 @@ A label should not be declared
1423where a label with the same name is visible, 1423where a label with the same name is visible,
1424even if this other label has been declared in an enclosing block. 1424even if this other label has been declared in an enclosing block.
1425 1425
1426Labels and empty statements are called @def{void statements},
1427as they perform no actions.
1428
1429The @Rw{break} statement terminates the execution of a 1426The @Rw{break} statement terminates the execution of a
1430@Rw{while}, @Rw{repeat}, or @Rw{for} loop, 1427@Rw{while}, @Rw{repeat}, or @Rw{for} loop,
1431skipping to the next statement after the loop: 1428skipping to the next statement after the loop:
@@ -2361,6 +2358,7 @@ Lua is a lexically scoped language.
2361The scope of a local variable begins at the first statement after 2358The scope of a local variable begins at the first statement after
2362its declaration and lasts until the last non-void statement 2359its declaration and lasts until the last non-void statement
2363of the innermost block that includes the declaration. 2360of the innermost block that includes the declaration.
2361(@emph{Void statements} are labels and empty statements.)
2364Consider the following example: 2362Consider the following example:
2365@verbatim{ 2363@verbatim{
2366x = 10 -- global variable 2364x = 10 -- global variable
@@ -3165,8 +3163,7 @@ The index must be the last index previously marked to be closed
3165A @idx{__close} metamethod cannot yield 3163A @idx{__close} metamethod cannot yield
3166when called through this function. 3164when called through this function.
3167 3165
3168(Exceptionally, this function was introduced in release 5.4.3. 3166(This function was introduced in @N{release 5.4.3}.)
3169It is not present in previous 5.4 releases.)
3170 3167
3171} 3168}
3172 3169
@@ -3713,7 +3710,7 @@ Pops a key from the stack,
3713and pushes a key@En{}value pair from the table at the given index, 3710and pushes a key@En{}value pair from the table at the given index,
3714the @Q{next} pair after the given key. 3711the @Q{next} pair after the given key.
3715If there are no more elements in the table, 3712If there are no more elements in the table,
3716then @Lid{lua_next} returns 0 and pushes nothing. 3713then @Lid{lua_next} @N{returns 0} and pushes nothing.
3717 3714
3718A typical table traversal looks like this: 3715A typical table traversal looks like this:
3719@verbatim{ 3716@verbatim{
@@ -5539,8 +5536,8 @@ It is defined as the following macro:
5539@verbatim{ 5536@verbatim{
5540(luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0)) 5537(luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0))
5541} 5538}
5542It returns @Lid{LUA_OK} if there are no errors, 5539It @N{returns 0} (@Lid{LUA_OK}) if there are no errors,
5543or an error code in case of errors @see{statuscodes}. 5540or 1 in case of errors.
5544 5541
5545} 5542}
5546 5543
@@ -5552,8 +5549,8 @@ It is defined as the following macro:
5552@verbatim{ 5549@verbatim{
5553(luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0)) 5550(luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0))
5554} 5551}
5555It returns @Lid{LUA_OK} if there are no errors, 5552It @N{returns 0} (@Lid{LUA_OK}) if there are no errors,
5556or an error code in case of errors @see{statuscodes}. 5553or 1 in case of errors.
5557 5554
5558} 5555}
5559 5556
@@ -8577,7 +8574,7 @@ the returned status is this number.
8577The default value for @id{code} is @true. 8574The default value for @id{code} is @true.
8578 8575
8579If the optional second argument @id{close} is true, 8576If the optional second argument @id{close} is true,
8580closes the Lua state before exiting. 8577the function closes the Lua state before exiting @seeF{lua_close}.
8581 8578
8582} 8579}
8583 8580
@@ -8985,12 +8982,16 @@ The options are:
8985@item{@T{-i}| enter interactive mode after running @rep{script};} 8982@item{@T{-i}| enter interactive mode after running @rep{script};}
8986@item{@T{-l @rep{mod}}| @Q{require} @rep{mod} and assign the 8983@item{@T{-l @rep{mod}}| @Q{require} @rep{mod} and assign the
8987 result to global @rep{mod};} 8984 result to global @rep{mod};}
8985@item{@T{-l @rep{g=mod}}| @Q{require} @rep{mod} and assign the
8986 result to global @rep{g};}
8988@item{@T{-v}| print version information;} 8987@item{@T{-v}| print version information;}
8989@item{@T{-E}| ignore environment variables;} 8988@item{@T{-E}| ignore environment variables;}
8990@item{@T{-W}| turn warnings on;} 8989@item{@T{-W}| turn warnings on;}
8991@item{@T{--}| stop handling options;} 8990@item{@T{--}| stop handling options;}
8992@item{@T{-}| execute @id{stdin} as a file and stop handling options.} 8991@item{@T{-}| execute @id{stdin} as a file and stop handling options.}
8993} 8992}
8993(The form @T{-l @rep{g=mod}} was introduced in @N{release 5.4.4}.)
8994
8994After handling its options, @id{lua} runs the given @emph{script}. 8995After handling its options, @id{lua} runs the given @emph{script}.
8995When called without arguments, 8996When called without arguments,
8996@id{lua} behaves as @T{lua -v -i} 8997@id{lua} behaves as @T{lua -v -i}