aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-11-29 16:02:44 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-11-29 16:02:44 -0200
commit6d04537ea660fd12fc16c328366b701fabaf4919 (patch)
tree41eab6e4d87552e29731db552f7d58d679c56973 /manual
parent7696c6474fe51ed59fee324e78c1233af74febdd (diff)
downloadlua-6d04537ea660fd12fc16c328366b701fabaf4919.tar.gz
lua-6d04537ea660fd12fc16c328366b701fabaf4919.tar.bz2
lua-6d04537ea660fd12fc16c328366b701fabaf4919.zip
A to-be-closed variable must have a closable value (or be nil)
It is an error for a to-be-closed variable to have a non-closable non-nil value when it is being closed. This situation does not seem to be useful and often hints to an error. (Particularly in the C API, it is easy to change a to-be-closed index by mistake.)
Diffstat (limited to 'manual')
-rw-r--r--manual/manual.of25
1 files changed, 16 insertions, 9 deletions
diff --git a/manual/manual.of b/manual/manual.of
index f891c33e..3902f2f3 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -1063,11 +1063,16 @@ which start with @T{0x} or @T{0X}.
1063Hexadecimal constants also accept an optional fractional part 1063Hexadecimal constants also accept an optional fractional part
1064plus an optional binary exponent, 1064plus an optional binary exponent,
1065marked by a letter @Char{p} or @Char{P}. 1065marked by a letter @Char{p} or @Char{P}.
1066
1066A numeric constant with a radix point or an exponent 1067A numeric constant with a radix point or an exponent
1067denotes a float; 1068denotes a float;
1068otherwise, 1069otherwise,
1069if its value fits in an integer, 1070if its value fits in an integer or it is a hexadecimal constant,
1070it denotes an integer. 1071it denotes an integer;
1072otherwise (that is, a decimal integer numeral that overflows),
1073it denotes a float.
1074(Hexadecimal integer numerals that overflow @emph{wrap around};
1075they always denote an integer value.)
1071Examples of valid integer constants are 1076Examples of valid integer constants are
1072@verbatim{ 1077@verbatim{
10733 345 0xff 0xBEBADA 10783 345 0xff 0xBEBADA
@@ -1542,7 +1547,8 @@ If the value of the variable when it goes out of scope is a function,
1542that function is called; 1547that function is called;
1543otherwise, if the value has a @idx{__close} metamethod, 1548otherwise, if the value has a @idx{__close} metamethod,
1544that metamethod is called; 1549that metamethod is called;
1545otherwise, nothing is done. 1550otherwise, if the value is @nil, nothing is done;
1551otherwise, an error is raised.
1546In the function case, 1552In the function case,
1547if the scope is being closed by an error, 1553if the scope is being closed by an error,
1548the error object is passed as an argument to the function; 1554the error object is passed as an argument to the function;
@@ -1665,7 +1671,7 @@ If both operands are integers,
1665the operation is performed over integers and the result is an integer. 1671the operation is performed over integers and the result is an integer.
1666Otherwise, if both operands are numbers, 1672Otherwise, if both operands are numbers,
1667then they are converted to floats, 1673then they are converted to floats,
1668the operation is performed following the usual rules 1674the operation is performed following the machine's rules
1669for floating-point arithmetic 1675for floating-point arithmetic
1670(usually the @x{IEEE 754} standard), 1676(usually the @x{IEEE 754} standard),
1671and the result is a float. 1677and the result is a float.
@@ -4998,7 +5004,7 @@ This call leaves the final string on the top of the stack.
4998 5004
4999} 5005}
5000 5006
5001If you know beforehand the total size of the resulting string, 5007If you know beforehand the maximum size of the resulting string,
5002you can use the buffer like this: 5008you can use the buffer like this:
5003@itemize{ 5009@itemize{
5004 5010
@@ -5012,7 +5018,8 @@ size @id{sz} with a call @T{luaL_buffinitsize(L, &b, sz)}.}
5012@item{ 5018@item{
5013Finish by calling @T{luaL_pushresultsize(&b, sz)}, 5019Finish by calling @T{luaL_pushresultsize(&b, sz)},
5014where @id{sz} is the total size of the resulting string 5020where @id{sz} is the total size of the resulting string
5015copied into that space. 5021copied into that space (which may be smaller than or
5022equal to the preallocated size).
5016} 5023}
5017 5024
5018} 5025}
@@ -5028,8 +5035,8 @@ when you call a buffer operation,
5028the stack is at the same level 5035the stack is at the same level
5029it was immediately after the previous buffer operation. 5036it was immediately after the previous buffer operation.
5030(The only exception to this rule is @Lid{luaL_addvalue}.) 5037(The only exception to this rule is @Lid{luaL_addvalue}.)
5031After calling @Lid{luaL_pushresult} the stack is back to its 5038After calling @Lid{luaL_pushresult},
5032level when the buffer was initialized, 5039the stack is back to its level when the buffer was initialized,
5033plus the final string on its top. 5040plus the final string on its top.
5034 5041
5035} 5042}
@@ -7118,7 +7125,7 @@ empty string as a match immediately after another match.
7118As an example, 7125As an example,
7119consider the results of the following code: 7126consider the results of the following code:
7120@verbatim{ 7127@verbatim{
7121> string.gsub("abc", "()a*()", print) 7128> string.gsub("abc", "()a*()", print);
7122--> 1 2 7129--> 1 2
7123--> 3 3 7130--> 3 3
7124--> 4 4 7131--> 4 4