diff options
| author | Roberto I <roberto@inf.puc-rio.br> | 2025-12-10 10:35:05 -0300 |
|---|---|---|
| committer | Roberto I <roberto@inf.puc-rio.br> | 2025-12-10 10:35:05 -0300 |
| commit | 82d721a8554df9b14ff520b4dd55ce5303ab560e (patch) | |
| tree | 7239992f3d30e51d982e1e19d018f61e6bf0236b /manual/manual.of | |
| parent | 104b0fc7008b1f6b7d818985fbbad05cd37ee654 (diff) | |
| download | lua-82d721a8554df9b14ff520b4dd55ce5303ab560e.tar.gz lua-82d721a8554df9b14ff520b4dd55ce5303ab560e.tar.bz2 lua-82d721a8554df9b14ff520b4dd55ce5303ab560e.zip | |
Format adjust in the manual
Lists in inline code don't get a space after commas. (That keeps the
code more compact and avoids line breaks in the middle of the code.)
Diffstat (limited to 'manual/manual.of')
| -rw-r--r-- | manual/manual.of | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/manual/manual.of b/manual/manual.of index 317adcaa..5fa4e097 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
| @@ -2091,12 +2091,12 @@ Note that keys that are not positive integers | |||
| 2091 | do not interfere with borders. | 2091 | do not interfere with borders. |
| 2092 | 2092 | ||
| 2093 | A table with exactly one border is called a @def{sequence}. | 2093 | A table with exactly one border is called a @def{sequence}. |
| 2094 | For instance, the table @T{{10, 20, 30, 40, 50}} is a sequence, | 2094 | For instance, the table @T{{10,20,30,40,50}} is a sequence, |
| 2095 | as it has only one border (5). | 2095 | as it has only one border (5). |
| 2096 | The table @T{{10, 20, 30, nil, 50}} has two borders (3 and 5), | 2096 | The table @T{{10,20,30,nil,50}} has two borders (3 and 5), |
| 2097 | and therefore it is not a sequence. | 2097 | and therefore it is not a sequence. |
| 2098 | (The @nil at index 4 is called a @emphx{hole}.) | 2098 | (The @nil at index 4 is called a @emphx{hole}.) |
| 2099 | The table @T{{nil, 20, 30, nil, nil, 60, nil}} | 2099 | The table @T{{nil,20,30,nil,nil,60,nil}} |
| 2100 | has three borders (0, 3, and 6), | 2100 | has three borders (0, 3, and 6), |
| 2101 | so it is not a sequence, too. | 2101 | so it is not a sequence, too. |
| 2102 | The table @T{{}} is a sequence with border 0. | 2102 | The table @T{{}} is a sequence with border 0. |
| @@ -2449,22 +2449,22 @@ These are the places where Lua expects a list of expressions: | |||
| 2449 | @description{ | 2449 | @description{ |
| 2450 | 2450 | ||
| 2451 | @item{A @rw{return} statement, | 2451 | @item{A @rw{return} statement, |
| 2452 | for instance @T{return e1, e2, e3} @see{control}.} | 2452 | for instance @T{return e1,e2,e3} @see{control}.} |
| 2453 | 2453 | ||
| 2454 | @item{A table constructor, | 2454 | @item{A table constructor, |
| 2455 | for instance @T{{e1, e2, e3}} @see{tableconstructor}.} | 2455 | for instance @T{{e1,e2,e3}} @see{tableconstructor}.} |
| 2456 | 2456 | ||
| 2457 | @item{The arguments of a function call, | 2457 | @item{The arguments of a function call, |
| 2458 | for instance @T{foo(e1, e2, e3)} @see{functioncall}.} | 2458 | for instance @T{foo(e1,e2,e3)} @see{functioncall}.} |
| 2459 | 2459 | ||
| 2460 | @item{A multiple assignment, | 2460 | @item{A multiple assignment, |
| 2461 | for instance @T{a, b, c = e1, e2, e3} @see{assignment}.} | 2461 | for instance @T{a,b,c = e1,e2,e3} @see{assignment}.} |
| 2462 | 2462 | ||
| 2463 | @item{A local or global declaration, | 2463 | @item{A local or global declaration, |
| 2464 | which is similar to a multiple assignment.} | 2464 | which is similar to a multiple assignment.} |
| 2465 | 2465 | ||
| 2466 | @item{The initial values in a generic @rw{for} loop, | 2466 | @item{The initial values in a generic @rw{for} loop, |
| 2467 | for instance @T{for k in e1, e2, e3 do ... end} @see{for}.} | 2467 | for instance @T{for k in e1,e2,e3 do ... end} @see{for}.} |
| 2468 | 2468 | ||
| 2469 | } | 2469 | } |
| 2470 | In the last four cases, | 2470 | In the last four cases, |
| @@ -2501,7 +2501,7 @@ we recommend assigning the vararg expression | |||
| 2501 | to a single variable and using that variable | 2501 | to a single variable and using that variable |
| 2502 | in its place. | 2502 | in its place. |
| 2503 | 2503 | ||
| 2504 | Here are some examples of uses of mutlres expressions. | 2504 | Here are some examples of uses of multires expressions. |
| 2505 | In all cases, when the construction needs | 2505 | In all cases, when the construction needs |
| 2506 | @Q{the n-th result} and there is no such result, | 2506 | @Q{the n-th result} and there is no such result, |
| 2507 | it uses a @nil. | 2507 | it uses a @nil. |
| @@ -3107,7 +3107,7 @@ void *luaL_alloc (void *ud, void *ptr, size_t osize, | |||
| 3107 | } | 3107 | } |
| 3108 | Note that @N{ISO C} ensures | 3108 | Note that @N{ISO C} ensures |
| 3109 | that @T{free(NULL)} has no effect and that | 3109 | that @T{free(NULL)} has no effect and that |
| 3110 | @T{realloc(NULL, size)} is equivalent to @T{malloc(size)}. | 3110 | @T{realloc(NULL,size)} is equivalent to @T{malloc(size)}. |
| 3111 | 3111 | ||
| 3112 | } | 3112 | } |
| 3113 | 3113 | ||
| @@ -3879,7 +3879,7 @@ is a seed for the hashing of strings. | |||
| 3879 | @apii{0,1,m} | 3879 | @apii{0,1,m} |
| 3880 | 3880 | ||
| 3881 | Creates a new empty table and pushes it onto the stack. | 3881 | Creates a new empty table and pushes it onto the stack. |
| 3882 | It is equivalent to @T{lua_createtable(L, 0, 0)}. | 3882 | It is equivalent to @T{lua_createtable(L,0,0)}. |
| 3883 | 3883 | ||
| 3884 | } | 3884 | } |
| 3885 | 3885 | ||
| @@ -5583,7 +5583,7 @@ Its pattern of use is as follows: | |||
| 5583 | 5583 | ||
| 5584 | @item{First declare a variable @id{b} of type @Lid{luaL_Buffer}.} | 5584 | @item{First declare a variable @id{b} of type @Lid{luaL_Buffer}.} |
| 5585 | 5585 | ||
| 5586 | @item{Then initialize it with a call @T{luaL_buffinit(L, &b)}.} | 5586 | @item{Then initialize it with a call @T{luaL_buffinit(L,&b)}.} |
| 5587 | 5587 | ||
| 5588 | @item{ | 5588 | @item{ |
| 5589 | Then add string pieces to the buffer calling any of | 5589 | Then add string pieces to the buffer calling any of |
| @@ -5604,12 +5604,12 @@ you can use the buffer like this: | |||
| 5604 | @item{First declare a variable @id{b} of type @Lid{luaL_Buffer}.} | 5604 | @item{First declare a variable @id{b} of type @Lid{luaL_Buffer}.} |
| 5605 | 5605 | ||
| 5606 | @item{Then initialize it and preallocate a space of | 5606 | @item{Then initialize it and preallocate a space of |
| 5607 | size @id{sz} with a call @T{luaL_buffinitsize(L, &b, sz)}.} | 5607 | size @id{sz} with a call @T{luaL_buffinitsize(L,&b,sz)}.} |
| 5608 | 5608 | ||
| 5609 | @item{Then produce the string into that space.} | 5609 | @item{Then produce the string into that space.} |
| 5610 | 5610 | ||
| 5611 | @item{ | 5611 | @item{ |
| 5612 | Finish by calling @T{luaL_pushresultsize(&b, sz)}, | 5612 | Finish by calling @T{luaL_pushresultsize(&b,sz)}, |
| 5613 | where @id{sz} is the total size of the resulting string | 5613 | where @id{sz} is the total size of the resulting string |
| 5614 | copied into that space (which may be less than or | 5614 | copied into that space (which may be less than or |
| 5615 | equal to the preallocated size). | 5615 | equal to the preallocated size). |
| @@ -6214,7 +6214,7 @@ You should not manually set integer keys in the table | |||
| 6214 | after the first use of @Lid{luaL_ref}. | 6214 | after the first use of @Lid{luaL_ref}. |
| 6215 | 6215 | ||
| 6216 | You can retrieve an object referred by the reference @id{r} | 6216 | You can retrieve an object referred by the reference @id{r} |
| 6217 | by calling @T{lua_rawgeti(L, t, r)} or @T{lua_geti(L, t, r)}. | 6217 | by calling @T{lua_rawgeti(L,t,r)} or @T{lua_geti(L,t,r)}. |
| 6218 | The function @Lid{luaL_unref} frees a reference. | 6218 | The function @Lid{luaL_unref} frees a reference. |
| 6219 | 6219 | ||
| 6220 | If the object on the top of the stack is @nil, | 6220 | If the object on the top of the stack is @nil, |
| @@ -7744,7 +7744,7 @@ If @id{j} is absent, then it is assumed to be equal to @num{-1} | |||
| 7744 | In particular, | 7744 | In particular, |
| 7745 | the call @T{string.sub(s,1,j)} returns a prefix of @id{s} | 7745 | the call @T{string.sub(s,1,j)} returns a prefix of @id{s} |
| 7746 | with length @id{j}, | 7746 | with length @id{j}, |
| 7747 | and @T{string.sub(s, -i)} (for a positive @id{i}) | 7747 | and @T{string.sub(s,-i)} (for a positive @id{i}) |
| 7748 | returns a suffix of @id{s} | 7748 | returns a suffix of @id{s} |
| 7749 | with length @id{i}. | 7749 | with length @id{i}. |
| 7750 | 7750 | ||
| @@ -8180,7 +8180,7 @@ the function returns @fail. | |||
| 8180 | A negative @id{n} gets characters before position @id{i}. | 8180 | A negative @id{n} gets characters before position @id{i}. |
| 8181 | The default for @id{i} is 1 when @id{n} is non-negative | 8181 | The default for @id{i} is 1 when @id{n} is non-negative |
| 8182 | and @T{#s + 1} otherwise, | 8182 | and @T{#s + 1} otherwise, |
| 8183 | so that @T{utf8.offset(s, -n)} gets the offset of the | 8183 | so that @T{utf8.offset(s,-n)} gets the offset of the |
| 8184 | @id{n}-th character from the end of the string. | 8184 | @id{n}-th character from the end of the string. |
| 8185 | 8185 | ||
| 8186 | As a special case, | 8186 | As a special case, |
| @@ -8233,7 +8233,7 @@ the table will have; its default is zero. | |||
| 8233 | 8233 | ||
| 8234 | Inserts element @id{value} at position @id{pos} in @id{list}, | 8234 | Inserts element @id{value} at position @id{pos} in @id{list}, |
| 8235 | shifting up the elements | 8235 | shifting up the elements |
| 8236 | @T{list[pos], list[pos+1], @Cdots, list[#list]}. | 8236 | @T{list[pos],list[pos+1],@Cdots,list[#list]}. |
| 8237 | The default value for @id{pos} is @T{#list+1}, | 8237 | The default value for @id{pos} is @T{#list+1}, |
| 8238 | so that a call @T{table.insert(t,x)} inserts @id{x} at the end | 8238 | so that a call @T{table.insert(t,x)} inserts @id{x} at the end |
| 8239 | of the list @id{t}. | 8239 | of the list @id{t}. |
| @@ -8271,7 +8271,7 @@ Removes from @id{list} the element at position @id{pos}, | |||
| 8271 | returning the value of the removed element. | 8271 | returning the value of the removed element. |
| 8272 | When @id{pos} is an integer between 1 and @T{#list}, | 8272 | When @id{pos} is an integer between 1 and @T{#list}, |
| 8273 | it shifts down the elements | 8273 | it shifts down the elements |
| 8274 | @T{list[pos+1], list[pos+2], @Cdots, list[#list]} | 8274 | @T{list[pos+1],list[pos+2],@Cdots,list[#list]} |
| 8275 | and erases element @T{list[#list]}; | 8275 | and erases element @T{list[#list]}; |
| 8276 | The index @id{pos} can also be 0 when @T{#list} is 0, | 8276 | The index @id{pos} can also be 0 when @T{#list} is 0, |
| 8277 | or @T{#list + 1}. | 8277 | or @T{#list + 1}. |
