Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/volumetric_fog/src/lib/script_engine/object.cc @ 9934

Last change on this file since 9934 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
Line 
1
2#include <iostream>
3
4#include "base_object.h"
5#include "lunar.h"
6
7#include "script_class.h"
8
9
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); }
16
17  //meber functions
18  void takeParam(int i)
19  {
20    printf("Lua passed %i to c++\n",i);
21  }
22
23  int printName(lua_State* L)
24  {
25    this->printName();
26    return 0;
27  }
28
29  void printName()
30  {
31    callCount ++;
32    printf("Hi i'm object %p ! This is the %i. call.\n",this,callCount);
33  }
34
35  int getCallCount(){ return callCount; }
36
37private:
38  int callCount;
39
40};
41
42
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.