lua-users home
lua-l archive

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


Hi there,

I've last year chosen Lua to be the host language for my primary work in the
near future (game development) and I'd be more than interested in a better
native array support.
Right now I just use 0 instead of nil for empty spaces and I manually track
the length of all my arrays that might be dynamic in whatever way as I don't
want to pay for a full iteration each time I want to know the size.

Another big downside besides performance and the handling of empty slots is
actually that I have to create my arrays by sequentially filling them after
construction, potentially triggering multiple reallocs and in the end, due
the nature of dynamic arrays, with a lot of unused space. Given I primarily
work on sim/city builder types of games I have thousands of active agents in
my maps constantly creating new arrays for their paths etc. so that's
probably what hurts me most.

That said, at the moment, I use two existing frameworks and for one I don't
have any sources (Corona) and the other one uses LuaJIT so no chance of
getting new features soon anyway. But my usage of Lua goes back about 20
years (3.2) and I hope there's another 20 to come, so I'm still very
interested in the future of the language.

> -----Ursprüngliche Nachricht-----
> Von: lua-l-bounces@lists.lua.org <lua-l-bounces@lists.lua.org> Im Auftrag
> von Petri Häkkinen
> Gesendet: Dienstag, 27. März 2018 18:38
> An: Lua mailing list <lua-l@lists.lua.org>
> Betreff: Re: Lua 5.4-work1 with first class arrays (implementation &
> benchmarks)
> 
> Bumping this thread just this once, as I find the lack of interest on this
> strange...
> 
> Is no-one else interested in O(1) implementation for the # operator,
native
> (faster than tables) array implementation and how it can be used to solve
the
> hole issue and issues with pack/unpack?
> 
> I think an array type is the right way to go for Lua, considering it
solves many
> issues and also gives a nice perf boost.
> 
> Petri