From e3ce88c9e850b7e79751083014699c5eae1bff31 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 23 Oct 2024 17:16:17 -0300 Subject: New function 'lua_numbertostrbuff' It converts a Lua number to a string in a buffer, without creating a new Lua string. --- manual/manual.of | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'manual') diff --git a/manual/manual.of b/manual/manual.of index 6947b2a0..f0b17b4c 100644 --- a/manual/manual.of +++ b/manual/manual.of @@ -675,7 +675,7 @@ approximately @M{n} bytes between steps. The garbage-collector step multiplier controls how much work each incremental step does. A value of @M{n} means the interpreter will execute -@M{n%} @emphx{units of work} for each byte allocated. +@M{n%} @emphx{units of work} for each word allocated. A unit of work corresponds roughly to traversing one slot or sweeping one object. Larger values make the collector more aggressive. @@ -3829,11 +3829,26 @@ This macro may evaluate its arguments more than once. } +@APIEntry{unsigned (lua_numbertostrbuff) (lua_State *L, int idx, + char *buff);| +@apii{0,0,-} + +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 conversion follows a non-specified format @see{coercion}. +The function returns the number of bytes written to the buffer +(including the final zero), +or zero if the value at @id{idx} is not a number. + +} + @APIEntry{int lua_pcall (lua_State *L, int nargs, int nresults, int msgh);| @apii{nargs + 1,nresults|1,-} Calls a function (or a callable object) in protected mode. + Both @id{nargs} and @id{nresults} have the same meaning as in @Lid{lua_call}. If there are no errors during the call, -- cgit v1.2.3-55-g6feb