aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-03-02 13:50:00 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-03-02 13:50:00 -0300
commitb7eb21c1efbd33affb87479fc6055914fe9ab009 (patch)
tree0a4f003b9a81f4afdce458b374cf0c7a76f25967
parentcf23a93d820558acdb8b1f0db85fdb94e709fee2 (diff)
downloadlua-b7eb21c1efbd33affb87479fc6055914fe9ab009.tar.gz
lua-b7eb21c1efbd33affb87479fc6055914fe9ab009.tar.bz2
lua-b7eb21c1efbd33affb87479fc6055914fe9ab009.zip
Normalization of metamethod typography in the manual
-rw-r--r--manual/manual.of20
1 files changed, 10 insertions, 10 deletions
diff --git a/manual/manual.of b/manual/manual.of
index e7040b2b..2e15839a 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -331,7 +331,7 @@ under certain events.
331You can change several aspects of the behavior 331You can change several aspects of the behavior
332of a value by setting specific fields in its metatable. 332of a value by setting specific fields in its metatable.
333For instance, when a non-numeric value is the operand of an addition, 333For instance, when a non-numeric value is the operand of an addition,
334Lua checks for a function in the field @St{__add} of the value's metatable. 334Lua checks for a function in the field @idx{__add} of the value's metatable.
335If it finds one, 335If it finds one,
336Lua calls this function to perform the addition. 336Lua calls this function to perform the addition.
337 337
@@ -344,7 +344,7 @@ In the previous example, the key is the string @St{__add}
344and the metamethod is the function that performs the addition. 344and the metamethod is the function that performs the addition.
345Unless stated otherwise, 345Unless stated otherwise,
346a metamethod may in fact be any @x{callable value}, 346a metamethod may in fact be any @x{callable value},
347which is either a function or a value with a @id{__call} metamethod. 347which is either a function or a value with a @idx{__call} metamethod.
348 348
349You can query the metatable of any value 349You can query the metatable of any value
350using the @Lid{getmetatable} function. 350using the @Lid{getmetatable} function.
@@ -505,7 +505,7 @@ when @id{key} is not present in @id{table}.
505The metavalue is looked up in the metatable of @id{table}. 505The metavalue is looked up in the metatable of @id{table}.
506 506
507The metavalue for this event can be either a function, a table, 507The metavalue for this event can be either a function, a table,
508or any value with an @id{__index} metavalue. 508or any value with an @idx{__index} metavalue.
509If it is a function, 509If it is a function,
510it is called with @id{table} and @id{key} as arguments, 510it is called with @id{table} and @id{key} as arguments,
511and the result of the call 511and the result of the call
@@ -514,7 +514,7 @@ is the result of the operation.
514Otherwise, 514Otherwise,
515the final result is the result of indexing this metavalue with @id{key}. 515the final result is the result of indexing this metavalue with @id{key}.
516This indexing is regular, not raw, 516This indexing is regular, not raw,
517and therefore can trigger another @id{__index} metavalue. 517and therefore can trigger another @idx{__index} metavalue.
518} 518}
519 519
520@item{@idx{__newindex}| 520@item{@idx{__newindex}|
@@ -526,14 +526,14 @@ The metavalue is looked up in the metatable of @id{table}.
526 526
527Like with indexing, 527Like with indexing,
528the metavalue for this event can be either a function, a table, 528the metavalue for this event can be either a function, a table,
529or any value with an @id{__newindex} metavalue. 529or any value with an @idx{__newindex} metavalue.
530If it is a function, 530If it is a function,
531it is called with @id{table}, @id{key}, and @id{value} as arguments. 531it is called with @id{table}, @id{key}, and @id{value} as arguments.
532Otherwise, 532Otherwise,
533Lua repeats the indexing assignment over this metavalue 533Lua repeats the indexing assignment over this metavalue
534with the same key and value. 534with the same key and value.
535This assignment is regular, not raw, 535This assignment is regular, not raw,
536and therefore can trigger another @id{__newindex} metavalue. 536and therefore can trigger another @idx{__newindex} metavalue.
537 537
538Whenever a @idx{__newindex} metavalue is invoked, 538Whenever a @idx{__newindex} metavalue is invoked,
539Lua does not perform the primitive assignment. 539Lua does not perform the primitive assignment.
@@ -742,7 +742,7 @@ For an object (table or userdata) to be finalized when collected,
742you must @emph{mark} it for finalization. 742you must @emph{mark} it for finalization.
743@index{mark (for finalization)} 743@index{mark (for finalization)}
744You mark an object for finalization when you set its metatable 744You mark an object for finalization when you set its metatable
745and the metatable has a field indexed by the string @St{__gc}. 745and the metatable has a @idx{__gc} metamethod.
746Note that if you set a metatable without a @idx{__gc} field 746Note that if you set a metatable without a @idx{__gc} field
747and later create that field in the metatable, 747and later create that field in the metatable,
748the object will not be marked for finalization. 748the object will not be marked for finalization.
@@ -3102,7 +3102,7 @@ Close the to-be-closed slot at the given index and set its value to @nil.
3102The index must be the last index previously marked to be closed 3102The index must be the last index previously marked to be closed
3103@see{lua_toclose} that is still active (that is, not closed yet). 3103@see{lua_toclose} that is still active (that is, not closed yet).
3104 3104
3105A @Lid{__close} metamethod cannot yield 3105A @idx{__close} metamethod cannot yield
3106when called through this function. 3106when called through this function.
3107 3107
3108(Exceptionally, this function was introduced in release 5.4.3. 3108(Exceptionally, this function was introduced in release 5.4.3.
@@ -9094,7 +9094,7 @@ want the old behavior
9094} 9094}
9095 9095
9096@item{ 9096@item{
9097The use of the @idx{__lt} metamethod to emulate @id{__le} 9097The use of the @idx{__lt} metamethod to emulate @idx{__le}
9098has been removed. 9098has been removed.
9099When needed, this metamethod must be explicitly defined. 9099When needed, this metamethod must be explicitly defined.
9100} 9100}
@@ -9130,7 +9130,7 @@ like any other error when calling a finalizer.)
9130The function @Lid{print} does not call @Lid{tostring} 9130The function @Lid{print} does not call @Lid{tostring}
9131to format its arguments; 9131to format its arguments;
9132instead, it has this functionality hardwired. 9132instead, it has this functionality hardwired.
9133You should use @id{__tostring} to modify how values are printed. 9133You should use @idx{__tostring} to modify how values are printed.
9134} 9134}
9135 9135
9136@item{ 9136@item{