[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua and Objects
- From: "Björklund, Peter" <Peter.Bjorklund@...>
- Date: Wed, 29 Aug 2001 18:02:20 +0200
Hi!
I'm sure that this question has been asked a few times. But bare with me :o)
In Lua I want to write something similar to this:
i = myExposedObject:someFunction( x )
In C++ I want to do something similar to:
static int someFunction( lua_State *L )
{
object = (CppClass *) lua_popSelf( L ); // Insert correct function
here
result = object->someFunctionImplementation();
lua_pushnumber( L, result );
return 1;
}
void main()
{
CppClass exposedObject;
// ....
lua_register( L, "someFunction", someFunction );
lua_setglobal( "myExposedObject", &exposedObject ); // Insert
correct function here
// ....
lua_dobuffer( ...... );
// ....
}
Please help me out!
/Peter Bjorklund
Programmer DICE AB