aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorRoberto I <roberto@inf.puc-rio.br>2025-08-09 15:08:53 -0300
committerRoberto I <roberto@inf.puc-rio.br>2025-08-09 15:08:53 -0300
commit5b179eaf6a78af5f000d76147af94669d04487b2 (patch)
treea3466ed22def25294ff1647d1af91cd4ef7fa567 /manual
parent8fddca81e7d4137512e92f398ca638d61b935dbd (diff)
downloadlua-5b179eaf6a78af5f000d76147af94669d04487b2.tar.gz
lua-5b179eaf6a78af5f000d76147af94669d04487b2.tar.bz2
lua-5b179eaf6a78af5f000d76147af94669d04487b2.zip
Details
Diffstat (limited to 'manual')
-rw-r--r--manual/manual.of32
1 files changed, 20 insertions, 12 deletions
diff --git a/manual/manual.of b/manual/manual.of
index b2765774..61dd42f2 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -127,7 +127,8 @@ strings can contain any 8-bit value,
127including @x{embedded zeros} (@Char{\0}). 127including @x{embedded zeros} (@Char{\0}).
128Lua is also encoding-agnostic; 128Lua is also encoding-agnostic;
129it makes no assumptions about the contents of a string. 129it makes no assumptions about the contents of a string.
130The length of any string in Lua must fit in a Lua integer. 130The length of any string in Lua must fit in a Lua integer,
131and the string plus a small header must fit in @id{size_t}.
131 132
132Lua can call (and manipulate) functions written in Lua and 133Lua can call (and manipulate) functions written in Lua and
133functions written in C @see{functioncall}. 134functions written in C @see{functioncall}.
@@ -1555,7 +1556,8 @@ It has the following syntax:
1555 exp @bnfter{,} exp @bnfopt{@bnfter{,} exp} @Rw{do} block @Rw{end}} 1556 exp @bnfter{,} exp @bnfopt{@bnfter{,} exp} @Rw{do} block @Rw{end}}
1556} 1557}
1557The given identifier (@bnfNter{Name}) defines the control variable, 1558The given identifier (@bnfNter{Name}) defines the control variable,
1558which is a new read-only variable local to the loop body (@emph{block}). 1559which is a new read-only (@id{const}) variable local to the loop body
1560(@emph{block}).
1559 1561
1560The loop starts by evaluating once the three control expressions. 1562The loop starts by evaluating once the three control expressions.
1561Their values are called respectively 1563Their values are called respectively
@@ -1610,7 +1612,7 @@ works as follows.
1610 1612
1611The names @rep{var_i} declare loop variables local to the loop body. 1613The names @rep{var_i} declare loop variables local to the loop body.
1612The first of these variables is the @emph{control variable}, 1614The first of these variables is the @emph{control variable},
1613which is a read-only variable. 1615which is a read-only (@id{const}) variable.
1614 1616
1615The loop starts by evaluating @rep{explist} 1617The loop starts by evaluating @rep{explist}
1616to produce four values: 1618to produce four values:
@@ -4083,7 +4085,7 @@ Lua will call @id{falloc} before raising the error.
4083 4085
4084 4086
4085@APIEntry{const char *lua_pushfstring (lua_State *L, const char *fmt, ...);| 4087@APIEntry{const char *lua_pushfstring (lua_State *L, const char *fmt, ...);|
4086@apii{0,1,m} 4088@apii{0,1,v}
4087 4089
4088Pushes onto the stack a formatted string 4090Pushes onto the stack a formatted string
4089and returns a pointer to this string @see{constchar}. 4091and returns a pointer to this string @see{constchar}.
@@ -4103,6 +4105,9 @@ A conversion specifier (and its corresponding extra argument) can be
4103Every occurrence of @Char{%} in the string @id{fmt} 4105Every occurrence of @Char{%} in the string @id{fmt}
4104must form a valid conversion specifier. 4106must form a valid conversion specifier.
4105 4107
4108Besides memory allocation errors,
4109this function may raise an error if the resulting string is too large.
4110
4106} 4111}
4107 4112
4108@APIEntry{void lua_pushglobaltable (lua_State *L);| 4113@APIEntry{void lua_pushglobaltable (lua_State *L);|
@@ -4135,7 +4140,7 @@ light userdata with the same @N{C address}.
4135} 4140}
4136 4141
4137@APIEntry{const char *lua_pushliteral (lua_State *L, const char *s);| 4142@APIEntry{const char *lua_pushliteral (lua_State *L, const char *s);|
4138@apii{0,1,m} 4143@apii{0,1,v}
4139 4144
4140This macro is equivalent to @Lid{lua_pushstring}, 4145This macro is equivalent to @Lid{lua_pushstring},
4141but should be used only when @id{s} is a literal string. 4146but should be used only when @id{s} is a literal string.
@@ -4144,7 +4149,7 @@ but should be used only when @id{s} is a literal string.
4144} 4149}
4145 4150
4146@APIEntry{const char *lua_pushlstring (lua_State *L, const char *s, size_t len);| 4151@APIEntry{const char *lua_pushlstring (lua_State *L, const char *s, size_t len);|
4147@apii{0,1,m} 4152@apii{0,1,v}
4148 4153
4149Pushes the string pointed to by @id{s} with size @id{len} 4154Pushes the string pointed to by @id{s} with size @id{len}
4150onto the stack. 4155onto the stack.
@@ -4156,6 +4161,9 @@ including @x{embedded zeros}.
4156 4161
4157Returns a pointer to the internal copy of the string @see{constchar}. 4162Returns a pointer to the internal copy of the string @see{constchar}.
4158 4163
4164Besides memory allocation errors,
4165this function may raise an error if the string is too large.
4166
4159} 4167}
4160 4168
4161@APIEntry{void lua_pushnil (lua_State *L);| 4169@APIEntry{void lua_pushnil (lua_State *L);|
@@ -5015,8 +5023,8 @@ then @id{name} is set to @id{NULL}.
5015@item{@id{namewhat}| 5023@item{@id{namewhat}|
5016explains the @T{name} field. 5024explains the @T{name} field.
5017The value of @T{namewhat} can be 5025The value of @T{namewhat} can be
5018@T{"global"}, @T{"local"}, @T{"method"}, 5026@T{"global"}, @T{"local"}, @T{"upvalue"},
5019@T{"field"}, @T{"upvalue"}, or @T{""} (the empty string), 5027@T{"field"}, @T{""} (the empty string), plus some other options,
5020according to how the function was called. 5028according to how the function was called.
5021(Lua uses the empty string when no other option seems to apply.) 5029(Lua uses the empty string when no other option seems to apply.)
5022} 5030}
@@ -6571,7 +6579,7 @@ The call always returns the previous value of the parameter.
6571If the call does not give a new value, 6579If the call does not give a new value,
6572the value is left unchanged. 6580the value is left unchanged.
6573 6581
6574Lua rounds these values before storing them; 6582Lua stores these values in a compressed format,
6575so, the value returned as the previous value may not be 6583so, the value returned as the previous value may not be
6576exactly the last value set. 6584exactly the last value set.
6577} 6585}
@@ -6585,10 +6593,10 @@ This function should not be called by a finalizer.
6585} 6593}
6586 6594
6587@LibEntry{dofile ([filename])| 6595@LibEntry{dofile ([filename])|
6588Opens the named file and executes its content as a Lua chunk. 6596Opens the named file and executes its content as a Lua chunk,
6597returning all values returned by the chunk.
6589When called without arguments, 6598When called without arguments,
6590@id{dofile} executes the content of the standard input (@id{stdin}). 6599@id{dofile} executes the content of the standard input (@id{stdin}).
6591Returns all values returned by the chunk.
6592In case of errors, @id{dofile} propagates the error 6600In case of errors, @id{dofile} propagates the error
6593to its caller. 6601to its caller.
6594(That is, @id{dofile} does not run in protected mode.) 6602(That is, @id{dofile} does not run in protected mode.)
@@ -6960,7 +6968,7 @@ in case of error
6960(either the original error that stopped the coroutine or 6968(either the original error that stopped the coroutine or
6961errors in closing methods), 6969errors in closing methods),
6962this function returns @false plus the error object; 6970this function returns @false plus the error object;
6963otherwise ir returns @true. 6971otherwise it returns @true.
6964 6972
6965} 6973}
6966 6974