aboutsummaryrefslogtreecommitdiff
path: root/manual/manual.of
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--manual/manual.of48
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
108Unless stated otherwise, 108Unless stated otherwise,
109any overflow when manipulating integer values @def{wrap around}, 109any overflow when manipulating integer values @def{wrap around},
110according to the usual rules of two-complement arithmetic. 110according to the usual rules of two's complement arithmetic.
111(In other words, 111(In other words,
112the actual result is the unique representable integer 112the actual result is the unique representable integer
113that is equal modulo @M{2@sp{n}} to the mathematical result, 113that is equal modulo @M{2@sp{n}} to the mathematical result,
@@ -2091,12 +2091,12 @@ Note that keys that are not positive integers
2091do not interfere with borders. 2091do not interfere with borders.
2092 2092
2093A table with exactly one border is called a @def{sequence}. 2093A table with exactly one border is called a @def{sequence}.
2094For instance, the table @T{{10, 20, 30, 40, 50}} is a sequence, 2094For instance, the table @T{{10,20,30,40,50}} is a sequence,
2095as it has only one border (5). 2095as it has only one border (5).
2096The table @T{{10, 20, 30, nil, 50}} has two borders (3 and 5), 2096The table @T{{10,20,30,nil,50}} has two borders (3 and 5),
2097and therefore it is not a sequence. 2097and 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}.)
2099The table @T{{nil, 20, 30, nil, nil, 60, nil}} 2099The table @T{{nil,20,30,nil,nil,60,nil}}
2100has three borders (0, 3, and 6), 2100has three borders (0, 3, and 6),
2101so it is not a sequence, too. 2101so it is not a sequence, too.
2102The table @T{{}} is a sequence with border 0. 2102The 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,
2452for instance @T{return e1, e2, e3} @see{control}.} 2452for instance @T{return e1,e2,e3} @see{control}.}
2453 2453
2454@item{A table constructor, 2454@item{A table constructor,
2455for instance @T{{e1, e2, e3}} @see{tableconstructor}.} 2455for 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,
2458for instance @T{foo(e1, e2, e3)} @see{functioncall}.} 2458for instance @T{foo(e1,e2,e3)} @see{functioncall}.}
2459 2459
2460@item{A multiple assignment, 2460@item{A multiple assignment,
2461for instance @T{a , b, c = e1, e2, e3} @see{assignment}.} 2461for 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,
2464which is similar to a multiple assignment.} 2464which 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,
2467for instance @T{for k in e1, e2, e3 do ... end} @see{for}.} 2467for instance @T{for k in e1,e2,e3 do ... end} @see{for}.}
2468 2468
2469} 2469}
2470In the last four cases, 2470In the last four cases,
@@ -2501,7 +2501,7 @@ we recommend assigning the vararg expression
2501to a single variable and using that variable 2501to a single variable and using that variable
2502in its place. 2502in its place.
2503 2503
2504Here are some examples of uses of mutlres expressions. 2504Here are some examples of uses of multires expressions.
2505In all cases, when the construction needs 2505In 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,
2507it uses a @nil. 2507it uses a @nil.
@@ -3107,7 +3107,7 @@ void *luaL_alloc (void *ud, void *ptr, size_t osize,
3107} 3107}
3108Note that @N{ISO C} ensures 3108Note that @N{ISO C} ensures
3109that @T{free(NULL)} has no effect and that 3109that @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.
3640The type of integers in Lua. 3640The type of integers in Lua.
3641 3641
3642By default this type is @id{long long}, 3642By default this type is @id{long long},
3643(usually a 64-bit two-complement integer), 3643(usually a 64-bit two's complement integer),
3644but that can be changed to @id{long} or @id{int} 3644but 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
3648Lua also defines the constants 3648Lua 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
3881Creates a new empty table and pushes it onto the stack. 3881Creates a new empty table and pushes it onto the stack.
3882It is equivalent to @T{lua_createtable(L, 0, 0)}. 3882It 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
5439common tasks. 5439common tasks.
5440 5440
5441All functions and types from the auxiliary library 5441All functions and types from the auxiliary library
5442are defined in header file @id{lauxlib.h} and 5442are defined in the header file @id{lauxlib.h} and
5443have a prefix @id{luaL_}. 5443have a prefix @id{luaL_}.
5444 5444
5445All functions in the auxiliary library are built on 5445All 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{
5589Then add string pieces to the buffer calling any of 5589Then 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
5607size @id{sz} with a call @T{luaL_buffinitsize(L, &b, sz)}.} 5607size @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{
5612Finish by calling @T{luaL_pushresultsize(&b, sz)}, 5612Finish by calling @T{luaL_pushresultsize(&b,sz)},
5613where @id{sz} is the total size of the resulting string 5613where @id{sz} is the total size of the resulting string
5614copied into that space (which may be less than or 5614copied into that space (which may be less than or
5615equal to the preallocated size). 5615equal to the preallocated size).
@@ -6214,7 +6214,7 @@ You should not manually set integer keys in the table
6214after the first use of @Lid{luaL_ref}. 6214after the first use of @Lid{luaL_ref}.
6215 6215
6216You can retrieve an object referred by the reference @id{r} 6216You can retrieve an object referred by the reference @id{r}
6217by calling @T{lua_rawgeti(L, t, r)} or @T{lua_geti(L, t, r)}. 6217by calling @T{lua_rawgeti(L,t,r)} or @T{lua_geti(L,t,r)}.
6218The function @Lid{luaL_unref} frees a reference. 6218The function @Lid{luaL_unref} frees a reference.
6219 6219
6220If the object on the top of the stack is @nil, 6220If the object on the top of the stack is @nil,
@@ -6492,7 +6492,7 @@ the host program can call the function @Lid{luaL_openlibs}.
6492Alternatively, 6492Alternatively,
6493the host can select which libraries to open, 6493the host can select which libraries to open,
6494by using @Lid{luaL_openselectedlibs}. 6494by using @Lid{luaL_openselectedlibs}.
6495Both functions are defined in the header file @id{lualib.h}. 6495Both functions are declared in the header file @id{lualib.h}.
6496@index{lualib.h} 6496@index{lualib.h}
6497 6497
6498The stand-alone interpreter @id{lua} @see{lua-sa} 6498The 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}
7744In particular, 7744In particular,
7745the call @T{string.sub(s,1,j)} returns a prefix of @id{s} 7745the call @T{string.sub(s,1,j)} returns a prefix of @id{s}
7746with length @id{j}, 7746with length @id{j},
7747and @T{string.sub(s, -i)} (for a positive @id{i}) 7747and @T{string.sub(s,-i)} (for a positive @id{i})
7748returns a suffix of @id{s} 7748returns a suffix of @id{s}
7749with length @id{i}. 7749with length @id{i}.
7750 7750
@@ -8180,7 +8180,7 @@ the function returns @fail.
8180A negative @id{n} gets characters before position @id{i}. 8180A negative @id{n} gets characters before position @id{i}.
8181The default for @id{i} is 1 when @id{n} is non-negative 8181The default for @id{i} is 1 when @id{n} is non-negative
8182and @T{#s + 1} otherwise, 8182and @T{#s + 1} otherwise,
8183so that @T{utf8.offset(s, -n)} gets the offset of the 8183so 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
8186As a special case, 8186As a special case,
@@ -8233,7 +8233,7 @@ the table will have; its default is zero.
8233 8233
8234Inserts element @id{value} at position @id{pos} in @id{list}, 8234Inserts element @id{value} at position @id{pos} in @id{list},
8235shifting up the elements 8235shifting up the elements
8236@T{list[pos], list[pos+1], @Cdots, list[#list]}. 8236@T{list[pos],list[pos+1],@Cdots,list[#list]}.
8237The default value for @id{pos} is @T{#list+1}, 8237The default value for @id{pos} is @T{#list+1},
8238so that a call @T{table.insert(t,x)} inserts @id{x} at the end 8238so that a call @T{table.insert(t,x)} inserts @id{x} at the end
8239of the list @id{t}. 8239of the list @id{t}.
@@ -8271,7 +8271,7 @@ Removes from @id{list} the element at position @id{pos},
8271returning the value of the removed element. 8271returning the value of the removed element.
8272When @id{pos} is an integer between 1 and @T{#list}, 8272When @id{pos} is an integer between 1 and @T{#list},
8273it shifts down the elements 8273it 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]}
8275and erases element @T{list[#list]}; 8275and erases element @T{list[#list]};
8276The index @id{pos} can also be 0 when @T{#list} is 0, 8276The index @id{pos} can also be 0 when @T{#list} is 0,
8277or @T{#list + 1}. 8277or @T{#list + 1}.