lua-users home
lua-l archive

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


> > Does ToLua handle C++ namespaces?  If not, is there a workaround?

> tolua handles "module", a concept similar to namespace.
> if you have a .pkg file with:
> 
> module modulename
> {
>      #define N
>      extern int var;
>      int func (...):
> }
> 
> it is valid to write the following lua code:
> 
> print(modulename.N, modulename.var)
> modulename.func(...)
Nice!  But how about if I want ToLua to create access to a variable that is
within a namespace.  For example, if my C++ code has the following:

namespace big
{
	int stuff;
	...
}


it would be accessed (if not within the namespace "big") with the line

	...
	big::stuff = 10;
	...


Can I put something like this in a .pkg file?  (Without the assignment, that
is).

> > What about Templates?

> there is no support for templates,
> but you can map instances of templates.

> $typedef MyList<double> NumberList;

> class NumberList {
>  ...
> };

Excellent!  Thanks...

Falko