lua-users home
lua-l archive

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


On Fri, Jul 21, 2017 at 12:21 PM, Rodrigo Azevedo <rodrigoams@gmail.com> wrote:
> Then, this seems to be an "implementation detail" that I would want to avoid.
>
> Is this possible? How?

The C API has a lua_createtable() function [1] allows you to specify
the size of the array part on table creation using the "narr"
parameter. This functionality isn't normally exposed to the Lua side,
and it does mean you have to know the exact length you want before you
begin populating the table, but if those are not problems for you then
this looks like your best opportunity.

[1] https://www.lua.org/manual/5.3/manual.html#lua_createtable

-Duncan