lua-users home
lua-l archive

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


On 20/07/2020 11:39, Lorenzo Donati wrote:
> Really, I can't understand why the simpler, easiest solution, has not
> been implemented yet: simply add a new function in table library for
> those efficiency aware programs where preallocating space for a table
> is paramount.
>
> The function is already there in C API (lua_createtable), so it can't
> possibly be considered "adding bloat" since it would be just a few
> bytes more to interface add the corresponding table library function.
>
> All the other proposals are really "hacks" and complicate matters
> adding conceptual overhead to the language and its syntax for a corner
> case. This corner case is, IMO, important enough to grant for an added
> `table.create` function, but it is not important enough to mess with
> the syntax (how many times would a user need to write #T=maxlen ?).
> Not to speak of the interactions with other mechanisms and syntax, as
> pointed out by other in this thread.

You mean like this?
https://github.com/DarkWiiPlayer/table_new/blob/master/table/new.c

(That's a rock, by the way, in case you want to use it)


Attachment: signature.asc
Description: OpenPGP digital signature