diff options
Diffstat (limited to '')
| -rw-r--r-- | manual/manual.of | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/manual/manual.of b/manual/manual.of index 54f67b3e..5fa4e097 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
| @@ -107,7 +107,7 @@ for small machines and embedded systems. | |||
| 107 | 107 | ||
| 108 | Unless stated otherwise, | 108 | Unless stated otherwise, |
| 109 | any overflow when manipulating integer values @def{wrap around}, | 109 | any overflow when manipulating integer values @def{wrap around}, |
| 110 | according to the usual rules of two-complement arithmetic. | 110 | according to the usual rules of two's complement arithmetic. |
| 111 | (In other words, | 111 | (In other words, |
| 112 | the actual result is the unique representable integer | 112 | the actual result is the unique representable integer |
| 113 | that is equal modulo @M{2@sp{n}} to the mathematical result, | 113 | that is equal modulo @M{2@sp{n}} to the mathematical result, |
| @@ -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 | ||
| @@ -3640,9 +3640,9 @@ because a pseudo-index is not an actual stack position. | |||
| 3640 | The type of integers in Lua. | 3640 | The type of integers in Lua. |
| 3641 | 3641 | ||
| 3642 | By default this type is @id{long long}, | 3642 | By default this type is @id{long long}, |
| 3643 | (usually a 64-bit two-complement integer), | 3643 | (usually a 64-bit two's complement integer), |
| 3644 | but that can be changed to @id{long} or @id{int} | 3644 | but that can be changed to @id{long} or @id{int} |
| 3645 | (usually a 32-bit two-complement integer). | 3645 | (usually a 32-bit two's complement integer). |
| 3646 | (See @id{LUA_INT_TYPE} in @id{luaconf.h}.) | 3646 | (See @id{LUA_INT_TYPE} in @id{luaconf.h}.) |
| 3647 | 3647 | ||
| 3648 | Lua also defines the constants | 3648 | Lua also defines the constants |
| @@ -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 | ||
| @@ -5439,7 +5439,7 @@ the auxiliary library provides higher-level functions for some | |||
| 5439 | common tasks. | 5439 | common tasks. |
| 5440 | 5440 | ||
| 5441 | All functions and types from the auxiliary library | 5441 | All functions and types from the auxiliary library |
| 5442 | are defined in header file @id{lauxlib.h} and | 5442 | are defined in the header file @id{lauxlib.h} and |
| 5443 | have a prefix @id{luaL_}. | 5443 | have a prefix @id{luaL_}. |
| 5444 | 5444 | ||
| 5445 | All functions in the auxiliary library are built on | 5445 | All functions in the auxiliary library are built on |
| @@ -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, |
| @@ -6492,7 +6492,7 @@ the host program can call the function @Lid{luaL_openlibs}. | |||
| 6492 | Alternatively, | 6492 | Alternatively, |
| 6493 | the host can select which libraries to open, | 6493 | the host can select which libraries to open, |
| 6494 | by using @Lid{luaL_openselectedlibs}. | 6494 | by using @Lid{luaL_openselectedlibs}. |
| 6495 | Both functions are defined in the header file @id{lualib.h}. | 6495 | Both functions are declared in the header file @id{lualib.h}. |
| 6496 | @index{lualib.h} | 6496 | @index{lualib.h} |
| 6497 | 6497 | ||
| 6498 | The stand-alone interpreter @id{lua} @see{lua-sa} | 6498 | The stand-alone interpreter @id{lua} @see{lua-sa} |
| @@ -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}. |
