Luna 四 |
|
// declaration static const char *className; static const Luna < T >::FunctionType Functions[]; static const Luna < T >::PropertyType Properties[]; bool isExisting; // This is used by Luna to see whether it's been created by createFromExisting. Don't set it. bool isPrecious; // This is used to tell Luna not to garbage collect the object, in case other objects might reference it. Set it in your classes constructor. // implementation const char *T::className = "YourClassNameInLua"; const Luna < T >::FunctionType T::Functions[] = { {"myFunction", &T::updateAll}, {0} }; const Luna < RPhysicsManager >::PropertyType RPhysicsManager::Properties[] = { {"myProperty", &T::getProperty, &layer::setProperty }, {0} };
int myFunction(lua_State* L)
int T::getProperty(lua_State* L) { lua_pushnumber(L,X); return 1; } int T::setProperty(lua_State* L) { myCPPClassVar = lua_tonumber(L,-1); return 0; }
{"__eq", &T::myComparisonFunction},
Luna < core::RColor >::Register(L,"Namespace");
myobject = Namespace.MyClass();