mixed table data structures

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

mixed table data structures

Phoenix Sol
In practice, would you say that it is better to use separate tables  
for different data structures? To avoid creating tables with both  
'list' and 'map'  components?

Phoenix Sol
Reply | Threaded
Open this post in threaded view
|

Re: mixed table data structures

Duncan Cross


On Sun, Jun 21, 2009 at 2:10 AM, Phoenix Sol <[hidden email]> wrote:
In practice, would you say that it is better to use separate tables for different data structures? To avoid creating tables with both 'list' and 'map'  components?

Phoenix Sol

It's a little bit of a pain to loop over the non-array part of a mixed table only, but apart from that I can't say I've found any reason to avoid doing it.

-Duncan

Reply | Threaded
Open this post in threaded view
|

Re: mixed table data structures

Wesley Smith
I really like the mixed array, map data structure.  It's incredibly
handy for sorting map keys.  I'm wondering what the best way to
iterator just over the map keys is.  Is there any other way aside from


for k, v in pairs(map) do
    if(type(k) ~= "number") then
        -- do something
    end
end


On Sun, Jun 21, 2009 at 10:22 AM, Duncan Cross<[hidden email]> wrote:

>
>
> On Sun, Jun 21, 2009 at 2:10 AM, Phoenix Sol <[hidden email]>
> wrote:
>>
>> In practice, would you say that it is better to use separate tables for
>> different data structures? To avoid creating tables with both 'list' and
>> 'map'  components?
>>
>> Phoenix Sol
>
> It's a little bit of a pain to loop over the non-array part of a mixed table
> only, but apart from that I can't say I've found any reason to avoid doing
> it.
>
> -Duncan
>
>