aboutsummaryrefslogtreecommitdiff
path: root/manual/manual.of
diff options
context:
space:
mode:
Diffstat (limited to 'manual/manual.of')
-rw-r--r--manual/manual.of28
1 files changed, 19 insertions, 9 deletions
diff --git a/manual/manual.of b/manual/manual.of
index beea41f9..ad273d62 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -3079,11 +3079,12 @@ the allocator must behave like @id{realloc}.
3079In particular, the allocator returns @id{NULL} 3079In particular, the allocator returns @id{NULL}
3080if and only if it cannot fulfill the request. 3080if and only if it cannot fulfill the request.
3081 3081
3082Here is a simple implementation for the @x{allocator function}. 3082Here is a simple implementation for the @x{allocator function},
3083It is used in the auxiliary library by @Lid{luaL_newstate}. 3083corresponding to the function @Lid{luaL_alloc} from the
3084auxiliary library.
3084@verbatim{ 3085@verbatim{
3085static void *l_alloc (void *ud, void *ptr, size_t osize, 3086void *luaL_alloc (void *ud, void *ptr, size_t osize,
3086 size_t nsize) { 3087 size_t nsize) {
3087 (void)ud; (void)osize; /* not used */ 3088 (void)ud; (void)osize; /* not used */
3088 if (nsize == 0) { 3089 if (nsize == 0) {
3089 free(ptr); 3090 free(ptr);
@@ -5988,9 +5989,8 @@ it does not run it.
5988@apii{0,0,-} 5989@apii{0,0,-}
5989 5990
5990Returns a value with a weak attempt for randomness. 5991Returns a value with a weak attempt for randomness.
5991(It produces that value based on the current date and time 5992The parameter @id{L} can be @id{NULL}
5992and the address of an internal variable, 5993if there is no Lua state available.
5993in case the machine has Address Space Layout Randomization.)
5994 5994
5995} 5995}
5996 5996
@@ -6046,8 +6046,9 @@ with @id{tname} in the registry.
6046@apii{0,0,-} 6046@apii{0,0,-}
6047 6047
6048Creates a new Lua state. 6048Creates a new Lua state.
6049It calls @Lid{lua_newstate} with an 6049It calls @Lid{lua_newstate} with @Lid{luaL_alloc} as
6050allocator based on the @N{ISO C} allocation functions 6050the allocator function and the result of @T{luaL_makeseed(NULL)}
6051as the seed,
6051and then sets a warning function and a panic function @see{C-error} 6052and then sets a warning function and a panic function @see{C-error}
6052that print messages to the standard error output. 6053that print messages to the standard error output.
6053 6054
@@ -6272,6 +6273,15 @@ in the registry @seeC{luaL_newmetatable}.
6272} 6273}
6273 6274
6274@APIEntry{ 6275@APIEntry{
6276void *luaL_alloc (void *ud, void *ptr, size_t osize, size_t nsize);|
6277
6278A standard allocator function for Lua @seeF{lua_Alloc},
6279built on top of the C functions @id{realloc} and @id{free}.
6280
6281}
6282
6283
6284@APIEntry{
6275typedef struct luaL_Stream { 6285typedef struct luaL_Stream {
6276 FILE *f; 6286 FILE *f;
6277 lua_CFunction closef; 6287 lua_CFunction closef;