lua-users home
lua-l archive

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


zhao xin <esrrhs@163.com> 于2023年8月3日周四 12:59写道:

> I know the lua_createtable can do this thing, but it will call C function.
> so is the possible add some support in lua?
>
> local t = {(100, 0)} -- give t 100 array capacity

You may need:

local t = { table.unpack({}, 1, 100) }

But I think 100 is a very small number, you don't need reserve the new
array table for this small size.

-- 
http://blog.codingnow.com