@@ -289,7 +289,7 @@ Whenever there is an error,
289289an @def{error object}
290290is propagated with information about the error.
291291Lua itself only generates errors whose error object is a string,
292- but programs may generate errors with
292+ but programs can generate errors with
293293any value as the error object.
294294It is up to the Lua program or its host to handle such error objects.
295295For historical reasons,
@@ -298,7 +298,7 @@ even though it does not have to be a string.
298298
299299
300300When you use @Lid{xpcall} (or @Lid{lua_pcall}, in C)
301- you may give a @def{message handler}
301+ you can give a @def{message handler}
302302to be called in case of errors.
303303This function is called with the original error object
304304and returns a new error object.
@@ -343,7 +343,7 @@ which is then called a @def{metamethod}.
343343In the previous example, the key is the string @St{__add}
344344and the metamethod is the function that performs the addition.
345345Unless stated otherwise,
346- a metamethod may in fact be any @x{callable value},
346+ a metamethod can in fact be any @x{callable value},
347347which is either a function or a value with a @idx{__call} metamethod.
348348
349349You can query the metatable of any value
@@ -1421,7 +1421,7 @@ labels in Lua are considered statements too:
14211421
14221422A label is visible in the entire block where it is defined,
14231423except inside nested functions.
1424- A goto may jump to any visible label as long as it does not
1424+ A goto can jump to any visible label as long as it does not
14251425enter into the scope of a local variable.
14261426A label should not be declared
14271427where a label with the same name is visible,
@@ -4549,7 +4549,7 @@ corresponding Lua value is removed from the stack @see{constchar}.
45494549
45504550This function can raise memory errors only
45514551when converting a number to a string
4552- (as then it may have to create a new string).
4552+ (as then it may create a new string).
45534553
45544554}
45554555
@@ -6113,8 +6113,8 @@ The metatable is created by the I/O library
61136113
61146114This userdata must start with the structure @id{luaL_Stream};
61156115it can contain other data after this initial structure.
6116- The field @id{f} points to the corresponding C stream
6117- ( or it can be @id{NULL} to indicate an incompletely created handle) .
6116+ The field @id{f} points to the corresponding C stream,
6117+ or it is @id{NULL} to indicate an incompletely created handle.
61186118The field @id{closef} points to a Lua function
61196119that will be called to close the stream
61206120when the handle is closed or collected;
@@ -9239,11 +9239,25 @@ Lua repeatedly prompts and waits for a line.
92399239After reading a line,
92409240Lua first try to interpret the line as an expression.
92419241If it succeeds, it prints its value.
9242- Otherwise, it interprets the line as a statement .
9243- If you write an incomplete statement ,
9242+ Otherwise, it interprets the line as a chunk .
9243+ If you write an incomplete chunk ,
92449244the interpreter waits for its completion
92459245by issuing a different prompt.
92469246
9247+ Note that, as each complete line is read as a new chunk,
9248+ local variables do not outlive lines:
9249+ @verbatim{
9250+ > x = 20
9251+ > local x = 10; print(x) --> 10
9252+ > print(x) --> 20 -- global 'x'
9253+ > do -- incomplete line
9254+ >> local x = 10; print(x) -- '>>' prompts for line completion
9255+ >> print(x)
9256+ >> end -- line completed; Lua will run it as a single chunk
9257+ --> 10
9258+ --> 10
9259+ }
9260+
92479261If the global variable @defid{_PROMPT} contains a string,
92489262then its value is used as the prompt.
92499263Similarly, if the global variable @defid{_PROMPT2} contains a string,
0 commit comments