aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
Diffstat (limited to 'manual')
-rw-r--r--manual/manual.of42
1 files changed, 23 insertions, 19 deletions
diff --git a/manual/manual.of b/manual/manual.of
index b9ab1ebe..421d04de 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -83,25 +83,10 @@ it usually represents the absence of a useful value.
83The type @emph{boolean} has two values, @false and @true. 83The type @emph{boolean} has two values, @false and @true.
84Both @nil and @false make a condition false; 84Both @nil and @false make a condition false;
85any other value makes it true. 85any other value makes it true.
86The type @emph{number} represents both
87integer numbers and real (floating-point) numbers.
88The type @emph{string} represents immutable sequences of bytes.
89@index{eight-bit clean}
90Lua is 8-bit clean:
91strings can contain any 8-bit value,
92including @x{embedded zeros} (@Char{\0}).
93Lua is also encoding-agnostic;
94it makes no assumptions about the contents of a string.
95 86
96The type @emph{number} uses two internal representations, 87The type @emph{number} represents both
97or two @x{subtypes}, 88integer numbers and real (floating-point) numbers,
98one called @def{integer} and the other called @def{float}. 89using two @x{subtypes}: @def{integer} and @def{float}.
99Lua has explicit rules about when each representation is used,
100but it also converts between them automatically as needed @see{coercion}.
101Therefore,
102the programmer may choose to mostly ignore the difference
103between integers and floats
104or to assume complete control over the representation of each number.
105Standard Lua uses 64-bit integers and double-precision (64-bit) floats, 90Standard Lua uses 64-bit integers and double-precision (64-bit) floats,
106but you can also compile Lua so that it 91but you can also compile Lua so that it
107uses 32-bit integers and/or single-precision (32-bit) floats. 92uses 32-bit integers and/or single-precision (32-bit) floats.
@@ -110,6 +95,22 @@ is particularly attractive
110for small machines and embedded systems. 95for small machines and embedded systems.
111(See macro @id{LUA_32BITS} in file @id{luaconf.h}.) 96(See macro @id{LUA_32BITS} in file @id{luaconf.h}.)
112 97
98Lua has explicit rules about when each subtype is used,
99but it also converts between them automatically as needed @see{coercion}.
100Therefore,
101the programmer may choose to mostly ignore the difference
102between integers and floats
103or to assume complete control over the representation of each number.
104
105The type @emph{string} represents immutable sequences of bytes.
106@index{eight-bit clean}
107Lua is 8-bit clean:
108strings can contain any 8-bit value,
109including @x{embedded zeros} (@Char{\0}).
110Lua is also encoding-agnostic;
111it makes no assumptions about the contents of a string.
112The length of any string in Lua must fit in a Lua integer.
113
113Lua can call (and manipulate) functions written in Lua and 114Lua can call (and manipulate) functions written in Lua and
114functions written in C @see{functioncall}. 115functions written in C @see{functioncall}.
115Both are represented by the type @emph{function}. 116Both are represented by the type @emph{function}.
@@ -6788,13 +6789,16 @@ the string argument should not contain @x{embedded zeros}.
6788 6789
6789} 6790}
6790 6791
6791@LibEntry{string.gmatch (s, pattern)| 6792@LibEntry{string.gmatch (s, pattern [, init])|
6792Returns an iterator function that, 6793Returns an iterator function that,
6793each time it is called, 6794each time it is called,
6794returns the next captures from @id{pattern} @see{pm} 6795returns the next captures from @id{pattern} @see{pm}
6795over the string @id{s}. 6796over the string @id{s}.
6796If @id{pattern} specifies no captures, 6797If @id{pattern} specifies no captures,
6797then the whole match is produced in each call. 6798then the whole match is produced in each call.
6799A third, optional numeric argument @id{init} specifies
6800where to start the search;
6801its default value @N{is 1} and can be negative.
6798 6802
6799As an example, the following loop 6803As an example, the following loop
6800will iterate over all the words from string @id{s}, 6804will iterate over all the words from string @id{s},