lua-users home
lua-l archive

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


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<duncan.cross@gmail.com> wrote:
>
>
> On Sun, Jun 21, 2009 at 2:10 AM, Phoenix Sol <phoenix@burninglabs.com>
> 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
>
>