lua-users home
lua-l archive

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


I'm going to chime in because my thread was mentioned...

Yes, I started "C API - lua_next traversel of 'array' table" because it was pertinent to my users. People were serializing `std::vector` into tables and make that request that I supposed deserialization as well, but I didn't support deserializing a table into a `std::vector` precisely because I did not know the proper way to iterate the array. In previous issues before I asked, I told people not to rely on iteration order and that it would be dangerous. Still, I think having that thread was useful because it did a few things that I did not see digging into the archives previously:

1) established that Lua 5.3's `lua_geti` (and if you didn't need metatable access, Lua 5.2 and belows `lua_rawgeti`) were exceptionally performant (with actual numeric data and graphs) for dealing with iterating through what is called a sequence (typically an array in other languages)
2) addressed some clever ways to store the length without generating a pathological table case in many implementations and without having to override the #t operation (e.g., storing it in 0. I chose to store it in -1 simply because right now I support Lua tables that have iterations that start with 0, simply because that's the way some other libraries write their 'arrays' and I wanted to be flexible with that).
3) produced some insight for how to treat nil and what to expect from a sequence and the length operator

Yes, some of this addressed in the manual, but parts of it were not and as I understand it, this mailing list is for guidance. Therefore, before making the wrong choice permanently and shipping, I sought out proper guidance. While the conversation does linger on (and I still have a few unanswered questions about the history of Table and how I might manage pointers that get turned into `nil` in an array of pointers from C++), I don't think it's a bad or wasteful thread at all.

But that is just my opinion.

Sincerely,
ThePhD

On Sat, Aug 20, 2016 at 8:21 PM, Soni L. <fakedme@gmail.com> wrote:


On 20/08/16 09:13 PM, Ross Berteig wrote:


On 8/20/2016 5:01 PM, Soni L. wrote:
My goal is to stop the threads complaining about length calculations and
holes and stuff.

If you were paying attention to the mailing list recently, you should
know we had multiple threads about tables with holes. This could be
solved by making length an unknown.

Again, no.

The threads are all started by you with some new hair-brained idea of how to change the definition of Lua and the length operator.

It has a definition.

This thread stops here.


I didn't start "C API - lua_next traversal of "array" table".

I just wanna remove any notion of array from Lua so we don't get those threads anymore.

There were also threads about iterating tables with holes and stuff a while back. They were similar to the aforementioned thread.


--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.