[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Why no for table-iterator like e. g. "hashpairs"?
- From: bil til <flyer31@...>
- Date: Fri, 1 Nov 2019 01:55:36 -0700 (MST)
Additionally to pairs and ipairs, why does there not exist an interator
called e. g. "hashpairs"?
I assume quite often a very long listed/indexed table might have
additionally some further key-value pairs with "hash-keys". E. g. a
polyline/xy-curve with very many points might additionally have a name field
and maybe some further info fields.
If I want to iterate over such "further info fields" in a fast way in lua
(and I do NOT know the key names, or I possibly would like to check such
"further key names"), do I really have to iterate over the complete table
with pairs? (is this not a complete waste of time, as I then possibly get
also all the ipairs entries of the table for iteration in my for loop?).
(If I look at the Table struct in lobject.h, then it should be quite
straight forward to start iteration at the element "node" (I assume this is
the first hash key - value pair...?), and in such of such tables with large
array part (and I assume it is very common that the array part is large?)
this would speed up the for loop then tremendeously?)
Sent from: http://lua.2524044.n2.nabble.com/Lua-l-f2524044.html