[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: 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)?
- From: DarkWiiPlayer <darkwiiplayer@...>
- Date: Sun, 18 Oct 2020 23:51:16 +0200
In LuaJIT you can use `table.new` to create a table with a pre-allocated
array- and hash-part. Otherwise, it's only possible using the C API, but
I already built a small module to expose that API to Lua:
On 11/10/2020 09:58, 孙世龙 sunshilong wrote:
> 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.
> Could somebody shed some light on this question?
> I would be grateful to have some help with this question.
> Best wishes
Description: OpenPGP digital signature