aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-08-15 13:44:36 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-08-15 13:44:36 -0300
commita1d8eb27431c02c4529be1efd92143ad65434f3a (patch)
tree58db9340ba2b8ea1cb91004b96f15a955f167c58 /manual
parentf64a1b175a5fa65434a073e6d071b32bb7b0ab69 (diff)
downloadlua-a1d8eb27431c02c4529be1efd92143ad65434f3a.tar.gz
lua-a1d8eb27431c02c4529be1efd92143ad65434f3a.tar.bz2
lua-a1d8eb27431c02c4529be1efd92143ad65434f3a.zip
Added control messages to warnings
Added the concept of control messages to the warning system, plus the implementation of the controls "@on"/"@off" to turn warnings on/off. Moreover, the warning system in the test library adds some other controls to ease the test of warnings.
Diffstat (limited to 'manual')
-rw-r--r--manual/manual.of29
1 files changed, 22 insertions, 7 deletions
diff --git a/manual/manual.of b/manual/manual.of
index ff27a7d4..8c71c613 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -4370,6 +4370,8 @@ The third parameter is a boolean that
4370indicates whether the message is 4370indicates whether the message is
4371to be continued by the message in the next call. 4371to be continued by the message in the next call.
4372 4372
4373See @Lid{warn} for more details about warnings.
4374
4373} 4375}
4374 4376
4375@APIEntry{ 4377@APIEntry{
@@ -4380,6 +4382,8 @@ Emits a warning with the given message.
4380A message in a call with @id{tocont} true should be 4382A message in a call with @id{tocont} true should be
4381continued in another call to this function. 4383continued in another call to this function.
4382 4384
4385See @Lid{warn} for more details about warnings.
4386
4383} 4387}
4384 4388
4385@APIEntry{ 4389@APIEntry{
@@ -6355,6 +6359,16 @@ The current value of this variable is @St{Lua 5.4}.
6355Emits a warning with a message composed by the concatenation 6359Emits a warning with a message composed by the concatenation
6356of all its arguments (which should be strings). 6360of all its arguments (which should be strings).
6357 6361
6362By convention,
6363a one-piece message starting with @Char{@At}
6364is intended to be a @emph{control message},
6365which is a message to the warning system itself.
6366In particular, the standard warning function in Lua
6367recognizes the control messages @St{@At{}off},
6368to stop the emission of warnings,
6369and @St{@At{}on}, to (re)start the emission;
6370it ignores unknown control messages.
6371
6358} 6372}
6359 6373
6360@LibEntry{xpcall (f, msgh [, arg1, @Cdots])| 6374@LibEntry{xpcall (f, msgh [, arg1, @Cdots])|
@@ -7293,7 +7307,7 @@ stored as the first capture, and therefore has @N{number 1};
7293the character matching @St{.} is captured with @N{number 2}, 7307the character matching @St{.} is captured with @N{number 2},
7294and the part matching @St{%s*} has @N{number 3}. 7308and the part matching @St{%s*} has @N{number 3}.
7295 7309
7296As a special case, the empty capture @T{()} captures 7310As a special case, the capture @T{()} captures
7297the current string position (a number). 7311the current string position (a number).
7298For instance, if we apply the pattern @T{"()aa()"} on the 7312For instance, if we apply the pattern @T{"()aa()"} on the
7299string @T{"flaaap"}, there will be two captures: @N{3 and 5}. 7313string @T{"flaaap"}, there will be two captures: @N{3 and 5}.
@@ -7858,7 +7872,6 @@ they are compared as @x{unsigned integers}.
7858 7872
7859} 7873}
7860 7874
7861
7862@sect2{iolib| @title{Input and Output Facilities} 7875@sect2{iolib| @title{Input and Output Facilities}
7863 7876
7864The I/O library provides two different styles for file manipulation. 7877The I/O library provides two different styles for file manipulation.
@@ -8150,7 +8163,6 @@ There are three available modes:
8150@item{@St{line}| line buffering.} 8163@item{@St{line}| line buffering.}
8151} 8164}
8152 8165
8153}
8154For the last two cases, 8166For the last two cases,
8155@id{size} is a hint for the size of the buffer, in bytes. 8167@id{size} is a hint for the size of the buffer, in bytes.
8156The default is an appropriate size. 8168The default is an appropriate size.
@@ -8708,6 +8720,7 @@ The options are:
8708@item{@T{-i}| enters interactive mode after running @rep{script};} 8720@item{@T{-i}| enters interactive mode after running @rep{script};}
8709@item{@T{-v}| prints version information;} 8721@item{@T{-v}| prints version information;}
8710@item{@T{-E}| ignores environment variables;} 8722@item{@T{-E}| ignores environment variables;}
8723@item{@T{-q}| turn warnings off;}
8711@item{@T{--}| stops handling options;} 8724@item{@T{--}| stops handling options;}
8712@item{@T{-}| executes @id{stdin} as a file and stops handling options.} 8725@item{@T{-}| executes @id{stdin} as a file and stops handling options.}
8713} 8726}
@@ -8733,12 +8746,13 @@ setting the values of
8733@Lid{package.path} and @Lid{package.cpath} 8746@Lid{package.path} and @Lid{package.cpath}
8734with the default paths defined in @id{luaconf.h}. 8747with the default paths defined in @id{luaconf.h}.
8735 8748
8736All options are handled in order, except @T{-i} and @T{-E}. 8749The options @T{-e}, @T{-l}, and @T{-q} are handled in
8750the order they appear.
8737For instance, an invocation like 8751For instance, an invocation like
8738@verbatim{ 8752@verbatim{
8739$ lua -e'a=1' -e 'print(a)' script.lua 8753$ lua -e 'a=1' -llib1 script.lua
8740} 8754}
8741will first set @id{a} to 1, then print the value of @id{a}, 8755will first set @id{a} to 1, then require the library @id{lib1},
8742and finally run the file @id{script.lua} with no arguments. 8756and finally run the file @id{script.lua} with no arguments.
8743(Here @T{$} is the shell prompt. Your prompt may be different.) 8757(Here @T{$} is the shell prompt. Your prompt may be different.)
8744 8758
@@ -8798,7 +8812,8 @@ has a metamethod @idx{__tostring},
8798the interpreter calls this metamethod to produce the final message. 8812the interpreter calls this metamethod to produce the final message.
8799Otherwise, the interpreter converts the error object to a string 8813Otherwise, the interpreter converts the error object to a string
8800and adds a stack traceback to it. 8814and adds a stack traceback to it.
8801Warnings are simply printed in the standard error output. 8815When warnings are on,
8816they are simply printed in the standard error output.
8802 8817
8803When finishing normally, 8818When finishing normally,
8804the interpreter closes its main Lua state 8819the interpreter closes its main Lua state