lua-users home
lua-l archive

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


Em dom., 11 de out. de 2020 às 04:58, 孙世龙 sunshilong <sunshilong369@gmail.com> escreveu:
Hi, list

Is it possible to pre-allocate a table with a specific size(i.e.
pre-allocating the max memory that may be used by a table)?

As per the book(Programming in Lua 4th Edition, page 37), which says that:
To represent a conventional array or a list, we simply use a table
with integer keys. There is neither a way
nor a need to declare a size.
As far as I know, there's no way.
Even the Lua C API is limited by int (MAX_INT).

regards,
Ranier Vilela