From ee99452158de5e2fa804bd10de7669848f3b3952 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 28 Feb 2025 14:53:58 -0300 Subject: 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. --- manual/manual.of | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'manual') 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} is propagated with information about the error. Lua itself only generates errors whose error object is a string, but programs can generate errors with -any value as the error object. +any value as the error object, +except @nil. +(Lua will change a @nil as error object to a string message.) It is up to the Lua program or its host to handle such error objects. For historical reasons, an error object is often called an @def{error message}, @@ -8082,6 +8084,8 @@ multiple assignment: The default for @id{a2} is @id{a1}. The destination range can overlap with the source range. The number of elements to be moved must fit in a Lua integer. +If @id{f} is larger than @id{e}, +nothing is moved. Returns the destination table @id{a2}. @@ -9402,6 +9406,11 @@ declare a local variable with the same name in the loop body. A chain of @id{__call} metamethods can have at most 15 objects. } +@item{ +In an error, a @nil as the error object is replaced by a +string message. +} + } } -- cgit v1.2.3-55-g6feb