aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-10 15:11:54 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-10 15:11:54 -0300
commit915c29f8bd0d4b0435a4b51a6c7913f5e170d09e (patch)
tree50c663be7df7982a7ffcc279d19f701144bfadf9
parent7ca3c40b50b385ead6b8bc4c54de97b61d11a12a (diff)
downloadlua-915c29f8bd0d4b0435a4b51a6c7913f5e170d09e.tar.gz
lua-915c29f8bd0d4b0435a4b51a6c7913f5e170d09e.tar.bz2
lua-915c29f8bd0d4b0435a4b51a6c7913f5e170d09e.zip
Improvements in the manual
Plus details
-rw-r--r--lapi.c3
-rw-r--r--ldo.c2
-rw-r--r--lstate.h2
-rw-r--r--manual/manual.of34
4 files changed, 23 insertions, 18 deletions
diff --git a/lapi.c b/lapi.c
index 01abfc15..4411cb29 100644
--- a/lapi.c
+++ b/lapi.c
@@ -671,9 +671,8 @@ static int auxgetstr (lua_State *L, const TValue *t, const char *k) {
671 lu_byte tag; 671 lu_byte tag;
672 TString *str = luaS_new(L, k); 672 TString *str = luaS_new(L, k);
673 luaV_fastget(t, str, s2v(L->top.p), luaH_getstr, tag); 673 luaV_fastget(t, str, s2v(L->top.p), luaH_getstr, tag);
674 if (!tagisempty(tag)) { 674 if (!tagisempty(tag))
675 api_incr_top(L); 675 api_incr_top(L);
676 }
677 else { 676 else {
678 setsvalue2s(L, L->top.p, str); 677 setsvalue2s(L, L->top.p, str);
679 api_incr_top(L); 678 api_incr_top(L);
diff --git a/ldo.c b/ldo.c
index f825d959..009bf47a 100644
--- a/ldo.c
+++ b/ldo.c
@@ -367,7 +367,7 @@ void luaD_shrinkstack (lua_State *L) {
367 luaD_reallocstack(L, nsize, 0); /* ok if that fails */ 367 luaD_reallocstack(L, nsize, 0); /* ok if that fails */
368 } 368 }
369 else /* don't change stack */ 369 else /* don't change stack */
370 condmovestack(L,{},{}); /* (change only for debugging) */ 370 condmovestack(L,(void)0,(void)0); /* (change only for debugging) */
371 luaE_shrinkCI(L); /* shrink CI list */ 371 luaE_shrinkCI(L); /* shrink CI list */
372} 372}
373 373
diff --git a/lstate.h b/lstate.h
index 1c81b6ed..e95c7288 100644
--- a/lstate.h
+++ b/lstate.h
@@ -186,7 +186,7 @@ typedef struct stringtable {
186*/ 186*/
187struct CallInfo { 187struct CallInfo {
188 StkIdRel func; /* function index in the stack */ 188 StkIdRel func; /* function index in the stack */
189 StkIdRel top; /* top for this function */ 189 StkIdRel top; /* top for this function */
190 struct CallInfo *previous, *next; /* dynamic call link */ 190 struct CallInfo *previous, *next; /* dynamic call link */
191 union { 191 union {
192 struct { /* only for Lua functions */ 192 struct { /* only for Lua functions */
diff --git a/manual/manual.of b/manual/manual.of
index a441cea1..bb95148a 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -1428,7 +1428,7 @@ except inside nested functions.
1428A goto can jump to any visible label as long as it does not 1428A goto can jump to any visible label as long as it does not
1429enter into the scope of a local variable. 1429enter into the scope of a local variable.
1430A label should not be declared 1430A label should not be declared
1431where a label with the same name is visible, 1431where a previous label with the same name is visible,
1432even if this other label has been declared in an enclosing block. 1432even if this other label has been declared in an enclosing block.
1433 1433
1434The @Rw{break} statement terminates the execution of a 1434The @Rw{break} statement terminates the execution of a
@@ -3835,7 +3835,7 @@ This macro may evaluate its arguments more than once.
3835 3835
3836Converts the number at acceptable index @id{idx} to a string 3836Converts the number at acceptable index @id{idx} to a string
3837and puts the result in @id{buff}. 3837and puts the result in @id{buff}.
3838The buffer must have a size of at least @Lid{LUA_N2SBUFFSZ} bytes. 3838The buffer must have a size of at least @defid{LUA_N2SBUFFSZ} bytes.
3839The conversion follows a non-specified format @see{coercion}. 3839The conversion follows a non-specified format @see{coercion}.
3840The function returns the number of bytes written to the buffer 3840The function returns the number of bytes written to the buffer
3841(including the final zero), 3841(including the final zero),
@@ -3997,25 +3997,22 @@ Lua will call @id{falloc} before raising the error.
3997 3997
3998Pushes onto the stack a formatted string 3998Pushes onto the stack a formatted string
3999and returns a pointer to this string @see{constchar}. 3999and returns a pointer to this string @see{constchar}.
4000It is similar to the @ANSI{sprintf}, 4000The result is a copy of @id{fmt} with
4001but has two important differences. 4001each @emph{conversion specifier} replaced by its respective
4002First, 4002extra argument.
4003you do not have to allocate space for the result; 4003A conversion specifier can be
4004the result is a Lua string and Lua takes care of memory allocation
4005(and deallocation, through garbage collection).
4006Second,
4007the conversion specifiers are quite restricted.
4008There are no flags, widths, or precisions.
4009The conversion specifiers can only be
4010@Char{%%} (inserts the character @Char{%}), 4004@Char{%%} (inserts the character @Char{%}),
4011@Char{%s} (inserts a zero-terminated string, with no size restrictions), 4005@Char{%s} (inserts a zero-terminated string, with no size restrictions),
4012@Char{%f} (inserts a @Lid{lua_Number}), 4006@Char{%f} (inserts a @Lid{lua_Number}),
4013@Char{%I} (inserts a @Lid{lua_Integer}), 4007@Char{%I} (inserts a @Lid{lua_Integer}),
4014@Char{%p} (inserts a pointer), 4008@Char{%p} (inserts a void pointer),
4015@Char{%d} (inserts an @T{int}), 4009@Char{%d} (inserts an @T{int}),
4016@Char{%c} (inserts an @T{int} as a one-byte character), and 4010@Char{%c} (inserts an @T{int} as a one-byte character), and
4017@Char{%U} (inserts an @T{unsigned long} as a @x{UTF-8} byte sequence). 4011@Char{%U} (inserts an @T{unsigned long} as a @x{UTF-8} byte sequence).
4018 4012
4013Every occurrence of @Char{%} in the string @id{fmt}
4014must form a valid conversion specifier.
4015
4019} 4016}
4020 4017
4021@APIEntry{void lua_pushglobaltable (lua_State *L);| 4018@APIEntry{void lua_pushglobaltable (lua_State *L);|
@@ -4413,7 +4410,7 @@ for the @Q{newindex} event @see{metatable}.
4413@APIEntry{void lua_settop (lua_State *L, int index);| 4410@APIEntry{void lua_settop (lua_State *L, int index);|
4414@apii{?,?,e} 4411@apii{?,?,e}
4415 4412
4416Accepts any index, @N{or 0}, 4413Receives any acceptable stack index, @N{or 0},
4417and sets the stack top to this index. 4414and sets the stack top to this index.
4418If the new top is greater than the old one, 4415If the new top is greater than the old one,
4419then the new elements are filled with @nil. 4416then the new elements are filled with @nil.
@@ -9428,6 +9425,15 @@ Moreover, there were some changes in the parameters themselves.
9428@itemize{ 9425@itemize{
9429 9426
9430@item{ 9427@item{
9428In @Lid{lua_call} and related functions,
9429the maximum value for the number of required results
9430(@id{nresults}) is 250.
9431If you really need a larger value,
9432use @Lid{LUA_MULTRET} and then adjust the stack size.
9433Previously, this limit was unspecified.
9434}
9435
9436@item{
9431@Lid{lua_newstate} has a third parameter, 9437@Lid{lua_newstate} has a third parameter,
9432a seed for the hashing of strings. 9438a seed for the hashing of strings.
9433} 9439}