[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Next version of Lua - new 'createtable' function
- From: Marco Antonio Abreu <mabreu.ti@...>
- Date: Tue, 16 Jun 2009 10:33:25 -0300
My problem starts when I need to load thousands of data in a table thousands of times during an execution.
Some time ago we had talked about an native function to create tables with predefined number of elements direct in Lua.
My basic question is why there is no function in the table library to mirror lua_createtable() from the C API?
Like our friend Jason Santos said, "I would like to be able to make
them dynamically and in pure lua. With this new function we will have
opportunities to reduce the amount of table.inserts." I suppose it will
be very useful if we could create a table with all occurrencies we need
direct from Lua, without using loadstring for a concatenated string or
thousands of table.inserts.
A binding for lua_createtable should be nice, but I thought in
something beyond. I suppose it could be interesting if we could give the
default value to the occurrencies created by the function and, in case
of this value be a function, it would be called to return the value and
the key of the element. What do you think about this?
Marco Antonio Abreu