#include #include "base_object.h" #include "lunar.h" #include "script_class.h" class Object : public BaseObject { public: Object(lua_State* L) {callCount = 0; } Object(){callCount = 0;this->setClassID(CL_TEST_OBJECT, "Object");}; ~Object() { printf("deleted Object (%p)\n", this); } //meber functions void takeParam(int i) { printf("Lua passed %i to c++\n",i); } int printName(lua_State* L) { this->printName(); return 0; } void printName() { callCount ++; printf("Hi i'm object %p ! This is the %i. call.\n",this,callCount); } int getCallCount(){ return callCount; } private: int callCount; }; CREATE_SCRIPTABLE_CLASS(Object, CL_TEST_OBJECT, addMethod("printName", ExecutorLua0(&Object::printName)) ->addMethod("getCallCount", ExecutorLua0ret(&Object::getCallCount)) ->addMethod("takeParam", ExecutorLua1(&Object::takeParam)));