Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/script_engine/object.cc @ 8748

Last change on this file since 8748 was 8408, checked in by bensch, 18 years ago

trunk: merged the script_engine branche back here
merged with command
svn merge https://svn.orxonox.net/orxonox/branches/script_engine . -r8284:HEAD
no conflicts

File size: 1009 bytes
RevLine 
[8248]1
2#include <iostream>
3
[8250]4#include "base_object.h"
5#include "lunar.h"
[8248]6
[8250]7#include "script_class.h"
[8248]8
9
[8408]10class Object : public BaseObject
11{
12public:
13  Object(lua_State* L) {callCount = 0; }
14  Object(){callCount = 0;this->setClassID(CL_TEST_OBJECT, "Object");};
15  ~Object() { printf("deleted Object (%p)\n", this); }
[8248]16
[8408]17  //meber functions
18  void takeParam(int i)
19  {
20    printf("Lua passed %i to c++\n",i);
21  }
[8248]22
[8408]23  int printName(lua_State* L)
24  {
25    this->printName();
26    return 0;
27  }
[8248]28
[8408]29  void printName()
30  {
31    callCount ++;
32    printf("Hi i'm object %p ! This is the %i. call.\n",this,callCount);
33  }
[8248]34
[8408]35  int getCallCount(){ return callCount; }
[8248]36
[8408]37private:
38  int callCount;
[8248]39
[8408]40};
[8248]41
42
[8408]43CREATE_SCRIPTABLE_CLASS(Object, CL_TEST_OBJECT,
44                        addMethod("printName", ExecutorLua0<Object>(&Object::printName))
45                        ->addMethod("getCallCount", ExecutorLua0ret<Object, int>(&Object::getCallCount))
46                        ->addMethod("takeParam", ExecutorLua1<Object, int>(&Object::takeParam)));
Note: See TracBrowser for help on using the repository browser.