4 ms·
My Lua isn't strong, but I think this is what you're looking for: Data structure initialization: https://github.com/rxi/lite/blob/master/data/core/doc/init.lua
by thedirt0115 6y ago
My Lua isn't strong, but I think this is what you're looking for:
Data structure initialization:
https://github.com/rxi/lite/blob/master/data/core/doc/init.lua#L48 https://github.com/rxi/lite/blob/master/data/core/doc/init.l...
How insertion works here, which illuminates how the table is used:
https://github.com/rxi/lite/blob/143f8867a13a35f5688ad7c97717dddf8bc58cd2/data/core/doc/init.lua#L230 https://github.com/rxi/lite/blob/143f8867a13a35f5688ad7c9771...
- aspaceman 6y agoAnd if you want to take that a step further down the rabbit hole, here's how Lua allocates the table in memory: https://stackoverflow.com/a/29930168 https://stackoverflow.com/a/29930168 It's two dynamic arrays, of hashes and values, whose sizes grow as powers of two.
- dtf 6y agoLooks like an array of lines, which is a completely reasonable structure to use. There's a good post on the Visual Studio Code blog about why and when they moved on from an array of lines to a new structure based on a piece table. https://code.visualstudio.com/blogs/2018/03/23/text-buffer-reimplementation https://code.visualstudio.com/blogs/2018/03/23/text-buffer-r...