lua-users home
lua-l archive

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

class A { public: int var; };

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?

// untested & from memory so you may want to check it! Havent had any coffee
yet either :-)

>>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

-- lua code
a_inst = A:new()  -- new() creates the object by return? See toLua docs for

// C code header & pkg
void a_wrapped_func(A* a);

>>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?)

Now I need coffee.