aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-02-28 14:53:58 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-02-28 14:53:58 -0300
commitee99452158de5e2fa804bd10de7669848f3b3952 (patch)
treea68b8834ef0f61f9a7a2ce297ab3963cec8e56d9 /manual
parent127a8e80fe0d74efd26994b3877cdc77b712ea56 (diff)
downloadlua-ee99452158de5e2fa804bd10de7669848f3b3952.tar.gz
lua-ee99452158de5e2fa804bd10de7669848f3b3952.tar.bz2
lua-ee99452158de5e2fa804bd10de7669848f3b3952.zip
Error object cannot be nil
Lua will change a nil as error object to a string message, so that it never reports an error with nil as the error object.
Diffstat (limited to 'manual')
-rw-r--r--manual/manual.of11
1 files changed, 10 insertions, 1 deletions
diff --git a/manual/manual.of b/manual/manual.of
index ff4e79fe..b34e1e9c 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -290,7 +290,9 @@ an @def{error object}
290is propagated with information about the error. 290is propagated with information about the error.
291Lua itself only generates errors whose error object is a string, 291Lua itself only generates errors whose error object is a string,
292but programs can generate errors with 292but programs can generate errors with
293any value as the error object. 293any value as the error object,
294except @nil.
295(Lua will change a @nil as error object to a string message.)
294It is up to the Lua program or its host to handle such error objects. 296It is up to the Lua program or its host to handle such error objects.
295For historical reasons, 297For historical reasons,
296an error object is often called an @def{error message}, 298an error object is often called an @def{error message},
@@ -8082,6 +8084,8 @@ multiple assignment:
8082The default for @id{a2} is @id{a1}. 8084The default for @id{a2} is @id{a1}.
8083The destination range can overlap with the source range. 8085The destination range can overlap with the source range.
8084The number of elements to be moved must fit in a Lua integer. 8086The number of elements to be moved must fit in a Lua integer.
8087If @id{f} is larger than @id{e},
8088nothing is moved.
8085 8089
8086Returns the destination table @id{a2}. 8090Returns the destination table @id{a2}.
8087 8091
@@ -9402,6 +9406,11 @@ declare a local variable with the same name in the loop body.
9402A chain of @id{__call} metamethods can have at most 15 objects. 9406A chain of @id{__call} metamethods can have at most 15 objects.
9403} 9407}
9404 9408
9409@item{
9410In an error, a @nil as the error object is replaced by a
9411string message.
9412}
9413
9405} 9414}
9406 9415
9407} 9416}