diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-03-02 13:50:00 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-03-02 13:50:00 -0300 |
commit | b7eb21c1efbd33affb87479fc6055914fe9ab009 (patch) | |
tree | 0a4f003b9a81f4afdce458b374cf0c7a76f25967 | |
parent | cf23a93d820558acdb8b1f0db85fdb94e709fee2 (diff) | |
download | lua-b7eb21c1efbd33affb87479fc6055914fe9ab009.tar.gz lua-b7eb21c1efbd33affb87479fc6055914fe9ab009.tar.bz2 lua-b7eb21c1efbd33affb87479fc6055914fe9ab009.zip |
Normalization of metamethod typography in the manual
-rw-r--r-- | manual/manual.of | 20 |
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. | |||
331 | You can change several aspects of the behavior | 331 | You can change several aspects of the behavior |
332 | of a value by setting specific fields in its metatable. | 332 | of a value by setting specific fields in its metatable. |
333 | For instance, when a non-numeric value is the operand of an addition, | 333 | For instance, when a non-numeric value is the operand of an addition, |
334 | Lua checks for a function in the field @St{__add} of the value's metatable. | 334 | Lua checks for a function in the field @idx{__add} of the value's metatable. |
335 | If it finds one, | 335 | If it finds one, |
336 | Lua calls this function to perform the addition. | 336 | Lua calls this function to perform the addition. |
337 | 337 | ||
@@ -344,7 +344,7 @@ In the previous example, the key is the string @St{__add} | |||
344 | and the metamethod is the function that performs the addition. | 344 | and the metamethod is the function that performs the addition. |
345 | Unless stated otherwise, | 345 | Unless stated otherwise, |
346 | a metamethod may in fact be any @x{callable value}, | 346 | a metamethod may in fact be any @x{callable value}, |
347 | which is either a function or a value with a @id{__call} metamethod. | 347 | which is either a function or a value with a @idx{__call} metamethod. |
348 | 348 | ||
349 | You can query the metatable of any value | 349 | You can query the metatable of any value |
350 | using the @Lid{getmetatable} function. | 350 | using the @Lid{getmetatable} function. |
@@ -505,7 +505,7 @@ when @id{key} is not present in @id{table}. | |||
505 | The metavalue is looked up in the metatable of @id{table}. | 505 | The metavalue is looked up in the metatable of @id{table}. |
506 | 506 | ||
507 | The metavalue for this event can be either a function, a table, | 507 | The metavalue for this event can be either a function, a table, |
508 | or any value with an @id{__index} metavalue. | 508 | or any value with an @idx{__index} metavalue. |
509 | If it is a function, | 509 | If it is a function, |
510 | it is called with @id{table} and @id{key} as arguments, | 510 | it is called with @id{table} and @id{key} as arguments, |
511 | and the result of the call | 511 | and the result of the call |
@@ -514,7 +514,7 @@ is the result of the operation. | |||
514 | Otherwise, | 514 | Otherwise, |
515 | the final result is the result of indexing this metavalue with @id{key}. | 515 | the final result is the result of indexing this metavalue with @id{key}. |
516 | This indexing is regular, not raw, | 516 | This indexing is regular, not raw, |
517 | and therefore can trigger another @id{__index} metavalue. | 517 | and 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 | ||
527 | Like with indexing, | 527 | Like with indexing, |
528 | the metavalue for this event can be either a function, a table, | 528 | the metavalue for this event can be either a function, a table, |
529 | or any value with an @id{__newindex} metavalue. | 529 | or any value with an @idx{__newindex} metavalue. |
530 | If it is a function, | 530 | If it is a function, |
531 | it is called with @id{table}, @id{key}, and @id{value} as arguments. | 531 | it is called with @id{table}, @id{key}, and @id{value} as arguments. |
532 | Otherwise, | 532 | Otherwise, |
533 | Lua repeats the indexing assignment over this metavalue | 533 | Lua repeats the indexing assignment over this metavalue |
534 | with the same key and value. | 534 | with the same key and value. |
535 | This assignment is regular, not raw, | 535 | This assignment is regular, not raw, |
536 | and therefore can trigger another @id{__newindex} metavalue. | 536 | and therefore can trigger another @idx{__newindex} metavalue. |
537 | 537 | ||
538 | Whenever a @idx{__newindex} metavalue is invoked, | 538 | Whenever a @idx{__newindex} metavalue is invoked, |
539 | Lua does not perform the primitive assignment. | 539 | Lua does not perform the primitive assignment. |
@@ -742,7 +742,7 @@ For an object (table or userdata) to be finalized when collected, | |||
742 | you must @emph{mark} it for finalization. | 742 | you must @emph{mark} it for finalization. |
743 | @index{mark (for finalization)} | 743 | @index{mark (for finalization)} |
744 | You mark an object for finalization when you set its metatable | 744 | You mark an object for finalization when you set its metatable |
745 | and the metatable has a field indexed by the string @St{__gc}. | 745 | and the metatable has a @idx{__gc} metamethod. |
746 | Note that if you set a metatable without a @idx{__gc} field | 746 | Note that if you set a metatable without a @idx{__gc} field |
747 | and later create that field in the metatable, | 747 | and later create that field in the metatable, |
748 | the object will not be marked for finalization. | 748 | the 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. | |||
3102 | The index must be the last index previously marked to be closed | 3102 | The 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 | ||
3105 | A @Lid{__close} metamethod cannot yield | 3105 | A @idx{__close} metamethod cannot yield |
3106 | when called through this function. | 3106 | when 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{ |
9097 | The use of the @idx{__lt} metamethod to emulate @id{__le} | 9097 | The use of the @idx{__lt} metamethod to emulate @idx{__le} |
9098 | has been removed. | 9098 | has been removed. |
9099 | When needed, this metamethod must be explicitly defined. | 9099 | When needed, this metamethod must be explicitly defined. |
9100 | } | 9100 | } |
@@ -9130,7 +9130,7 @@ like any other error when calling a finalizer.) | |||
9130 | The function @Lid{print} does not call @Lid{tostring} | 9130 | The function @Lid{print} does not call @Lid{tostring} |
9131 | to format its arguments; | 9131 | to format its arguments; |
9132 | instead, it has this functionality hardwired. | 9132 | instead, it has this functionality hardwired. |
9133 | You should use @id{__tostring} to modify how values are printed. | 9133 | You should use @idx{__tostring} to modify how values are printed. |
9134 | } | 9134 | } |
9135 | 9135 | ||
9136 | @item{ | 9136 | @item{ |