lua-users home
lua-l archive

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


Andrew Starks <andrew@starksfam.org> wrote:

> Top posting to nobody in particular.
> 
> I was arguing something about lengths or arrays at some point. Some
> helpful Lua List member kindly pointed something out to me:
> 
> Lua does not have sequences. It only has tables.
> 
> To put a positive spin on it: Lua has tables as it’s only data structure,
> at least as of 5.4, which will eliminate the limited ... (perhaps helped
> along by threads like this).
> 
> There is nothing that can’t be represented as a table and if you want
> something fancy, you have userdata. Adding sequences solves no problems.
> 
> “One data structure” is one of Lucas most important traits. I recommend
> learning to enjoy it and to play with that beautiful limitation.

I am going to assume you obviously meant "Lua's" there and not "Luacs"! ;)

When I was first learning Lua the whole "one data type only" system was an
interesting discovery. All sorts of data can fit within Tables, and the
whole meta-table system allows tables to be extended in a myriad of ways,
including object-orientated programming! Learning to think the "Lay Way"
when coming from static typed languages can be a bit of an adjustment!

I have added a very limited type of array to my hard fork... the Index data
type... simply because I did not want to invoke the overhead of table access
for object/class variables. This new data type has become the basis for a
large number of future features in my language as well. In a previous post
to the list Roberto said that the Table data type was the "bread and butter"
of Lua... I would have to say that is the Index data type in my language.

Sometimes, however, it is useful and helpful to have a sequence of data, and
to be able to manipulate that data as such. Tables do not have this ability
directly, however, I plan to create a data type to accommodate this type of
data. As the Ravi author pointed out, further optimisations can be made as
well for arrays if the type of the array is static and defined, this will
also help for access to C-land data... which is a goal of my language.


Elias Hogstvedt <eliashogstvedt@gmail.com> wrote:

> I'd like to create my own language as well with my own ideas. Perhaps I'll
> learn a thing or two as to why certain decisions are made.

I, too, am working on my own variant of Lua currently. I am also in the process
building a website to hold the various patches I have created since I started
hacking Lua back in... 2014... wow, time sure does fly! Sadly, I have not had
as much time as I would have liked to hack Lua over the past couple years...
however, I hope 2018 will be the year I get v1.0 of my language out the door!

I have immensely enjoyed hacking Lua as the size of the project is not daunting,
plus the codebase is quite well documented, and this list is an invaluable source
of information and support. If you have any questions about hacking Lua, or need
some help with a patch you are creating, feel free to ask here or off-list! :)

~Paige