lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Em sex., 2 de out. de 2020 às 11:18, Roberto Ierusalimschy <roberto@inf.puc-rio.br> escreveu:
> Maybe Lua never has to convert such large numbers.

The current limit is 44, you are worried that 32000 [or 2M] can be too
little?
Not really.



> But to satisfy luaS_newlstr, better pass the correct type?
>
> [...]
> -  int len = tostringbuff(obj, buff);
> +  size_t len = tostringbuff(obj, buff);

'tostringbuff' gets its result from lua_integer2str or lua_number2str,
which get this length from sprintf (or snprintf), which returns int.
This change would only move the cast to another place.
One step.
To remove all casts from strings, as possible.

regards,
Ranier Vilela