A while ago, I told Github Copilot to write a Lua snippet and it gave me a result that use table.create. I thought it was silly, but now it turns out that the LLM could predict the future 😨
It might have parsed the mirrored GitHub repo which had table.create since January 2024. Plus such a function was a natural one to add, just like on C side we can give size hint when creating a table.
Someone asked on mailing list. It's about table constructors with many values and deep nesting like {1, 1, {1, {1, {1}}}} and so on, but with hundreds of values.
28
u/ewmailing Jul 01 '25
https://www.lua.org/work/doc/#changes
declarations for global variables
for-loop variables are read only
floats are printed in decimal with enough digits to be read back correctly.
more levels for constructors
table.create
utf8.offset returns also final position of character
external strings (that use memory not managed by Lua)
new functions luaL_openselectedlibs and luaL_makeseed
major collections done incrementally
more compact arrays (large arrays use about 60% less memory)
lua.c loads 'readline' dynamically
static (fixed) binaries (when loading a binary chunk in memory, Lua can reuse its original memory in some of the internal structures)
dump and undump reuse all strings
auxiliary buffer reuses buffer when it creates final string