News for hackers. Stuff that matters.
Re:Lua, a Misunderstood Language (2021) by tkhattra on Thursday September 29, 2022 @03:05PM (#33025535)
i don't think that's true - lua stores sparse arrays efficiently. the table above should only have 2 slots allocated. see [1] or [4] for details on how lua implements sparse arrays.

[1] https://cacm.acm.org/magazines/2018/11/232214-a-look-at-the-... [2] http://www.lua.org/doc/jucs05.pdf

Re:Lua, a Misunderstood Language (2021) by maxdemarzi on Thursday September 29, 2022 @05:22PM (#33027389)
You are right. This code runs just fine on both of these online Lua websites. local tab = {} tab[938388893] = "hi" tab[987383332] = "Hello"

for k,v in pairs(tab) do print(k) print (v) end

https://www.lua.org/cgi-bin/demo https://luajit.me/

But when I try it using the Sol library (embedded in C++) it eats all my memory. Is it a Sol issue or a C Lua binding issue? Anybody know?

Re:Lua, a Misunderstood Language (2021) by tkhattra on Thursday September 29, 2022 @07:17PM (#33028662)
sorry, i'm not familiar with Sol. might be worth inquiring on the lua mailing list