summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-06-10 13:59:19 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-06-10 13:59:19 -0300
commitd2a9b4ffb86de29a201843edddfc0153a1846f96 (patch)
tree983ad04e90e07a84f8acde0be917d6940367f53e
parentf39e8c06d61078467b3f32499728ed4e9b7b06bc (diff)
downloadlua-github-d2a9b4ffb86de29a201843edddfc0153a1846f96.tar.gz
Detail in the manual
More precision describing the variables that won't be closed if a coroutine yields forever.
-rw-r--r--manual/manual.of11
1 files changed, 6 insertions, 5 deletions
diff --git a/manual/manual.of b/manual/manual.of
index fd49b404..725b12ad 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -1553,9 +1553,11 @@ interrupt the respective method,
but are otherwise ignored;
the error reported is the original one.
-If a coroutine yields inside a block and is never resumed again,
-the variables visible at that block will never go out of scope,
+If a coroutine yields and is never resumed again,
+some variables may never go out of scope,
and therefore they will never be closed.
+(These variables are the ones created inside the coroutine
+and in scope at the point where the coroutine yielded.)
Similarly, if a coroutine ends with an error,
it does not unwind its stack,
so it does not close any variable.
@@ -2245,9 +2247,9 @@ Consider the following example:
@verbatim{
a = {}
local x = 20
-for i=1,10 do
+for i = 1, 10 do
local y = 0
- a[i] = function () y=y+1; return x+y end
+ a[i] = function () y = y + 1; return x + y end
end
}
The loop creates ten closures
@@ -6815,7 +6817,6 @@ A value of @true as a fourth, optional argument @id{plain}
turns off the pattern matching facilities,
so the function does a plain @Q{find substring} operation,
with no characters in @id{pattern} being considered magic.
-Note that if @id{plain} is given, then @id{init} must be given as well.
If the pattern has captures,
then in a successful match