Re: Iterate over std::vector from LUA.

James Porter <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
On Thu, Jun 4, 2009 at 6:27 AM, Valery<[email protected]> wrote:
> I read it many times. First it is not clear for me what class A is. There is
> no its declaration not in module[].

In that example, replace "struct X" with "struct A" and it will be correct.

> Second, I would like to use iteration
> with typedef declaration (typedef std::vector<> X), but in the sample,
> std::vector is a member of class.

Rather than binding an STL container to Lua, you need to make a
function with return_stl_iterator. This means you can't just have Lua
hold an STL container and make it iterable (unless you write a
wrapper). It's not ideal, but a better solution isn't clear to me.

- Jim

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
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.