aboutsummaryrefslogtreecommitdiff
path: root/manual/manual.of
diff options
context:
space:
mode:
Diffstat (limited to 'manual/manual.of')
-rw-r--r--manual/manual.of18
1 files changed, 10 insertions, 8 deletions
diff --git a/manual/manual.of b/manual/manual.of
index bcc8173b..8f90f942 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -229,7 +229,7 @@ as the following example illustrates:
229@verbatim{ 229@verbatim{
230X = 1 -- Ok, global by default 230X = 1 -- Ok, global by default
231do 231do
232 global Y -- voids implicit initial declaration 232 global Y -- voids the implicit initial declaration
233 Y = 1 -- Ok, Y declared as global 233 Y = 1 -- Ok, Y declared as global
234 X = 1 -- ERROR, X not declared 234 X = 1 -- ERROR, X not declared
235end 235end
@@ -269,7 +269,7 @@ print(x) --> 10 (the global one)
269 269
270Notice that, in a declaration like @T{local x = x}, 270Notice that, in a declaration like @T{local x = x},
271the new @id{x} being declared is not in scope yet, 271the new @id{x} being declared is not in scope yet,
272and so the @id{x} in the left-hand side refers to the outside variable. 272and so the @id{x} in the right-hand side refers to the outside variable.
273 273
274Because of the @x{lexical scoping} rules, 274Because of the @x{lexical scoping} rules,
275local variables can be freely accessed by functions 275local variables can be freely accessed by functions
@@ -1651,11 +1651,12 @@ Function calls are explained in @See{functioncall}.
1651 1651
1652@sect3{localvar| @title{Variable Declarations} 1652@sect3{localvar| @title{Variable Declarations}
1653Local and global variables can be declared anywhere inside a block. 1653Local and global variables can be declared anywhere inside a block.
1654The declaration for locals can include an initialization: 1654The declaration can include an initialization:
1655@Produc{ 1655@Produc{
1656@producname{stat}@producbody{@Rw{local} 1656@producname{stat}@producbody{@Rw{local}
1657 attnamelist @bnfopt{@bnfter{=} explist}} 1657 attnamelist @bnfopt{@bnfter{=} explist}}
1658@producname{stat}@producbody{@Rw{global} attnamelist} 1658@producname{stat}@producbody{@Rw{global}
1659 attnamelist @bnfopt{@bnfter{=} explist}}
1659} 1660}
1660If present, an initial assignment has the same semantics 1661If present, an initial assignment has the same semantics
1661of a multiple assignment @see{assignment}. 1662of a multiple assignment @see{assignment}.
@@ -1712,7 +1713,8 @@ and a program that starts with any other global declaration
1712(e.g., @T{global none}) can only refer to declared variables. 1713(e.g., @T{global none}) can only refer to declared variables.
1713 1714
1714Note that, for global variables, 1715Note that, for global variables,
1715the effect of any declaration is only syntactical: 1716the effect of any declaration is only syntactical
1717(except for the optional assignment):
1716@verbatim{ 1718@verbatim{
1717global X <const>, _G 1719global X <const>, _G
1718X = 1 -- ERROR 1720X = 1 -- ERROR
@@ -3924,8 +3926,8 @@ This macro may evaluate its arguments more than once.
3924 3926
3925} 3927}
3926 3928
3927@APIEntry{unsigned (lua_numbertocstring) (lua_State *L, int idx, 3929@APIEntry{unsigned lua_numbertocstring (lua_State *L, int idx,
3928 char *buff);| 3930 char *buff);|
3929@apii{0,0,-} 3931@apii{0,0,-}
3930 3932
3931Converts the number at acceptable index @id{idx} to a string 3933Converts the number at acceptable index @id{idx} to a string
@@ -4050,7 +4052,7 @@ This function is equivalent to @Lid{lua_pushcclosure} with no upvalues.
4050 4052
4051} 4053}
4052 4054
4053@APIEntry{const char *(lua_pushexternalstring) (lua_State *L, 4055@APIEntry{const char *lua_pushexternalstring (lua_State *L,
4054 const char *s, size_t len, lua_Alloc falloc, void *ud);| 4056 const char *s, size_t len, lua_Alloc falloc, void *ud);|
4055@apii{0,1,m} 4057@apii{0,1,m}
4056 4058