lua-users home
lua-l archive

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


At 10:31 2003-06-14, you wrote:
At First, hi.
I'm new in this mailist, and i allready searched in the archived but i found nothing!
I want to call a funktion of a class, which was created in C++
But toLua, luabind and so can only created classes in LUA. But i can't get access to my classes which i defined in C++.
Is where a way to get access and call a C++ funktion of a class in Lua?
Here as example:
class foo
{
public:
    void call(void);
};

foo XY;

now in Lua:
XY:call();

Is somewhere a way to do this?

This is exactly what both luabind and tolua does.. In luabind you would do it like this:

module(L)
[
   class_<foo>("foo")
      .def("call" &foo::call)
];

Read the docs at http://luabind.sourceforge.net/..


Daniel Wallin, dalwan01@student.umu.se