Array class

Lua tables can take up more than 1.5MB for 100K elements which are simply numbers. It isn’t a whole lot of memory, but when you have confines on memory spaces (coughmobile*/cough*) it may be a good idea to provide another datatype which doesn’t have this limitation.

A pure C-based array doesn’t take this much memory (about 800KB for 100K elements (doubles)) - which makes it a good idea to provide to developers.

The examples shown in http://www.lua.org/pil/28.html explain my reasoning in more detail, and also outline some of the downfalls of having an array type.

Uh, I really don’t see the reasoning behind this. 1.5MB is still a small number, even on mobile. If you are actually running into memory problems from Lua quasi-tables and not Roblox’s geometry you are doing something terribly wrong - you shouldn’t even have a single table with 100k elements in it, and especially not on the client.

It would be nice if we could get more information on what you’re trying to do

Personally, I’m not doing anything. I’m just posting things that could be useful.

Although I like this idea, I think it takes away from the nature of how Lua (and other dynamic scripting languages) should function. Memory management like that should happen behind-the-scenes.

That being said, I agree that it would be nice to have some sort of data array that has a smaller footprint.

[quote] Although I like this idea, I think it takes away from the nature of how Lua (and other dynamic scripting languages) should function. Memory management like that should happen behind-the-scenes.

That being said, I agree that it would be nice to have some sort of data array that has a smaller footprint. [/quote]

The ideal language for me would be one in which all variables are typeless by default, but can be restricted to a particular type/object manually. This being said, Lua wouldn’t be my ideal language, but I do like the syntax more than any other language I’ve used.

[quote] Although I like this idea, I think it takes away from the nature of how Lua (and other dynamic scripting languages) should function. Memory management like that should happen behind-the-scenes.

That being said, I agree that it would be nice to have some sort of data array that has a smaller footprint. [/quote]

The ideal language for me would be one in which all variables are typeless by default, but can be restricted to a particular type/object manually. This being said, Lua wouldn’t be my ideal language, but I do like the syntax more than any other language I’ve used.[/quote]

You should look at Groovy. It’s a dynamic scripting language (but can now be statically compiled too) for Java. The awesome thing about it is that standard Java can be compiled too. Therefore, you get an awesome dynamic language that also allows you to have data constraints where you want them. I used it in my internship at Nationwide Insurance. It’s not a very fast language, but it’s fun to use.