lua-users home
lua-l archive

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


Suposse that i have a class in my C++ header:

class A { 
	public:
		int var;
}


Now, i export this class to lua using tolua 4.0a, i want to do the
following:


void some_host_program_function(void) {
	A *ptr_to_a;

	ptr_to_a = new A();

	// execute a lua function and pass ptr_to_a as a parameter 
	// How i Do that? 
}

Also, i want to know if is possible to.. instantiate a new A object in
lua.. then pass it back (via the return of a function) to the host
program.

And third, how do to pass "functors" to a function in lua?, maybe for...
i have a lua gui loop, and the callbacks must be executed in c++.. so..
i want to call the lua function set_callback() with a C++ "functor" as
argument. (and four :), can i set these functors callbacks in tag methods?)




Thanks in advance.


_------------------------------------------------------------.
| Nahuel Greco                 Web Development - Open Source |
| http://www.codelarvs.com.ar  Game Programming - Research   |
| Freelance coding / sysadmin  Networking. The answer is 42. |
'------------------------------------------------------------'