Re: luabind::iterator for arrays

Daniel Wallin <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
On Thu, Aug 12, 2010 at 6:27 PM, Ken Smith <[email protected]> wrote:
> I have a Lua table that contains array elements and I want to use
> luabind::iterator to visit them in order.  Is this possible?
...
>
> luabind::raw_iterator behaves the same.  Is traversing the list in
> array order possible with luabind::iterator or should I just use
> lua_rawgeti?

No, I'm afraid not. There should definitely be an iterator that does
that though. Patches are welcome. I was going to suggest doing
something like this in the meantime:

  for (std::size_t i = 1; i != len(table); ++i)
  {
      table[i] ... ;
  }

but it seems there is no len() function either. Again, patches are welcome. ;)

-- 
Daniel Wallin
BoostPro Computing
http://www.boostpro.com

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.