Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8295 was 8271, checked in by bensch, 18 years ago

merge

File size: 1.1 KB
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
10class Object : public BaseObject {
11   public:
12     static const char className[];
13     static Lunar<Object>::RegType methods[];
14
15     Object(lua_State* L) {callCount = 0; }
16     Object(){callCount = 0;};
17     ~Object() { printf("deleted Object (%p)\n", this); }
18
19        //meber functions
20     void takeParam(int i)
21     {
22       printf("Lua passed %i to c++\n",i);
23     }
24
25     int printName(lua_State* L)
26     {
27       this->printName();
28       return 0;
29     }
30
31     void printName()
32     {
33       callCount ++;
34       printf("Hi i'm object %p ! This is the %i. call.\n",this,callCount);
35     }
36
37     int getCallCount(){ return callCount; }
38
39   private:
40     int callCount;
41
42 };
43
44 const char Object::className[] = "Object";
45
46 Lunar<Object>::RegType Object::methods[] = {
47   {"printName", new ExecutorLua0<Object>(&Object::printName)},
48   {"getCallCount", new ExecutorLua0ret<Object, int>(&Object::getCallCount)},
49   {"takeParam", new ExecutorLua1<Object, int>(&Object::takeParam)},
50   {0,0}
51 };
[8250]52
53 CREATE_SCRIPTABLE_CLASS(Object, CL_TEST_OBJECT);
Note: See TracBrowser for help on using the repository browser.