mirror of
https://github.com/lua/lua
synced 2025-02-02 22:35:38 +03:00
Improvements in the manual
Plus details
This commit is contained in:
parent
7ca3c40b50
commit
915c29f8bd
3
lapi.c
3
lapi.c
@ -671,9 +671,8 @@ static int auxgetstr (lua_State *L, const TValue *t, const char *k) {
|
||||
lu_byte tag;
|
||||
TString *str = luaS_new(L, k);
|
||||
luaV_fastget(t, str, s2v(L->top.p), luaH_getstr, tag);
|
||||
if (!tagisempty(tag)) {
|
||||
if (!tagisempty(tag))
|
||||
api_incr_top(L);
|
||||
}
|
||||
else {
|
||||
setsvalue2s(L, L->top.p, str);
|
||||
api_incr_top(L);
|
||||
|
2
ldo.c
2
ldo.c
@ -367,7 +367,7 @@ void luaD_shrinkstack (lua_State *L) {
|
||||
luaD_reallocstack(L, nsize, 0); /* ok if that fails */
|
||||
}
|
||||
else /* don't change stack */
|
||||
condmovestack(L,{},{}); /* (change only for debugging) */
|
||||
condmovestack(L,(void)0,(void)0); /* (change only for debugging) */
|
||||
luaE_shrinkCI(L); /* shrink CI list */
|
||||
}
|
||||
|
||||
|
2
lstate.h
2
lstate.h
@ -186,7 +186,7 @@ typedef struct stringtable {
|
||||
*/
|
||||
struct CallInfo {
|
||||
StkIdRel func; /* function index in the stack */
|
||||
StkIdRel top; /* top for this function */
|
||||
StkIdRel top; /* top for this function */
|
||||
struct CallInfo *previous, *next; /* dynamic call link */
|
||||
union {
|
||||
struct { /* only for Lua functions */
|
||||
|
@ -1428,7 +1428,7 @@ except inside nested functions.
|
||||
A goto can jump to any visible label as long as it does not
|
||||
enter into the scope of a local variable.
|
||||
A label should not be declared
|
||||
where a label with the same name is visible,
|
||||
where a previous label with the same name is visible,
|
||||
even if this other label has been declared in an enclosing block.
|
||||
|
||||
The @Rw{break} statement terminates the execution of a
|
||||
@ -3835,7 +3835,7 @@ This macro may evaluate its arguments more than once.
|
||||
|
||||
Converts the number at acceptable index @id{idx} to a string
|
||||
and puts the result in @id{buff}.
|
||||
The buffer must have a size of at least @Lid{LUA_N2SBUFFSZ} bytes.
|
||||
The buffer must have a size of at least @defid{LUA_N2SBUFFSZ} bytes.
|
||||
The conversion follows a non-specified format @see{coercion}.
|
||||
The function returns the number of bytes written to the buffer
|
||||
(including the final zero),
|
||||
@ -3997,25 +3997,22 @@ Lua will call @id{falloc} before raising the error.
|
||||
|
||||
Pushes onto the stack a formatted string
|
||||
and returns a pointer to this string @see{constchar}.
|
||||
It is similar to the @ANSI{sprintf},
|
||||
but has two important differences.
|
||||
First,
|
||||
you do not have to allocate space for the result;
|
||||
the result is a Lua string and Lua takes care of memory allocation
|
||||
(and deallocation, through garbage collection).
|
||||
Second,
|
||||
the conversion specifiers are quite restricted.
|
||||
There are no flags, widths, or precisions.
|
||||
The conversion specifiers can only be
|
||||
The result is a copy of @id{fmt} with
|
||||
each @emph{conversion specifier} replaced by its respective
|
||||
extra argument.
|
||||
A conversion specifier can be
|
||||
@Char{%%} (inserts the character @Char{%}),
|
||||
@Char{%s} (inserts a zero-terminated string, with no size restrictions),
|
||||
@Char{%f} (inserts a @Lid{lua_Number}),
|
||||
@Char{%I} (inserts a @Lid{lua_Integer}),
|
||||
@Char{%p} (inserts a pointer),
|
||||
@Char{%p} (inserts a void pointer),
|
||||
@Char{%d} (inserts an @T{int}),
|
||||
@Char{%c} (inserts an @T{int} as a one-byte character), and
|
||||
@Char{%U} (inserts an @T{unsigned long} as a @x{UTF-8} byte sequence).
|
||||
|
||||
Every occurrence of @Char{%} in the string @id{fmt}
|
||||
must form a valid conversion specifier.
|
||||
|
||||
}
|
||||
|
||||
@APIEntry{void lua_pushglobaltable (lua_State *L);|
|
||||
@ -4413,7 +4410,7 @@ for the @Q{newindex} event @see{metatable}.
|
||||
@APIEntry{void lua_settop (lua_State *L, int index);|
|
||||
@apii{?,?,e}
|
||||
|
||||
Accepts any index, @N{or 0},
|
||||
Receives any acceptable stack index, @N{or 0},
|
||||
and sets the stack top to this index.
|
||||
If the new top is greater than the old one,
|
||||
then the new elements are filled with @nil.
|
||||
@ -9427,6 +9424,15 @@ Moreover, there were some changes in the parameters themselves.
|
||||
|
||||
@itemize{
|
||||
|
||||
@item{
|
||||
In @Lid{lua_call} and related functions,
|
||||
the maximum value for the number of required results
|
||||
(@id{nresults}) is 250.
|
||||
If you really need a larger value,
|
||||
use @Lid{LUA_MULTRET} and then adjust the stack size.
|
||||
Previously, this limit was unspecified.
|
||||
}
|
||||
|
||||
@item{
|
||||
@Lid{lua_newstate} has a third parameter,
|
||||
a seed for the hashing of strings.
|
||||
|
Loading…
x
Reference in New Issue
Block a user