lua-users home
lua-l archive

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


Tables are objects in the LUA world. I'm looking for an identifier for the C world. If I wanted to write a table traverser in LUA I would put the table itself as a key into another table to remember that this table has been visited.
I'm looking for the c/c++ equivalent: Putting the table id into an std::set.

My ideas:

1. Using the registry mechanism. But I don't know how this behaves with references on tables. 

2. Simply using lua_topointer(): Same question

-------- Original-Nachricht --------
> Datum: Mon, 30 May 2011 09:20:10 -0300
> Von: "Ignacio Burgueño" <ignaciob@inconcertcc.com>
> An: Lua mailing list <lua-l@lists.lua.org>
> Betreff: Re: Identifiers of tables on Stack from C/C++

> On Mon, May 30, 2011 at 4:05 AM, Joerg Walter <joerg-walter@gmx.de> wrote:
> 
> > Hi
> >
> > I'd like to cylce through a table variable from a C function. Since
> tables
> > can contain references on tables and since this can result in cyclic
> > structures I need to know somehow that I'm am stuck in a cycle at some
> > point. I have save remember which table I already have visited. What is
> an
> > appropriate identifier of a table and how can I retrieve it from C?
> >
> >
> >
> Can't you use the table itself as the key?

-- 
NEU: FreePhone - kostenlos mobil telefonieren!			
Jetzt informieren: http://www.gmx.net/de/go/freephone