lua-users home
lua-l archive

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


Here's an example of how to do it with tolua (4):

--
tolua_pushusertype(lua_state, (void*)&XY, tolua_tag(lua_state, "foo"));
lua_setglobal(lua_state, "XY");
--

That pushes the object XY to the stack and then creates a global called 'XY' on your luastate, with the correct tag (or you could use it to call a function, or set a table.. all the stuff you'll find on the API section of the manual).

bye..

Ariel.

At 10:31 14/06/2003 +0200, 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?

Cye Jonas

Ariel.
http://Anime.com.ar
snm