Changeset 7975 in orxonox.OLD for branches/script_engine/src/lib
- Timestamp:
- May 30, 2006, 11:52:41 AM (18 years ago)
- Location:
- branches/script_engine/src/lib/script_engine
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/script_engine/src/lib/script_engine/Makefile.am
r7962 r7975 10 10 bin_PROGRAMS = account 11 11 account_SOURCES = \ 12 account.cc 12 account.cc\ 13 Script.cc 14 13 15 14 16 … … 19 21 20 22 noinst_HEADERS = \ 21 lunar.h 23 lunar.h\ 24 Script.h -
branches/script_engine/src/lib/script_engine/account.cc
r7962 r7975 35 35 static Lunar<Object>::RegType methods[]; 36 36 37 Object(lua_State* L) { }37 Object(lua_State* L) {callCount = 0; } 38 38 ~Object() { printf("deleted Object (%p)\n", this); } 39 39 40 int printName(lua_State* L){std::cout<<"Hi i'm object!"<<std::endl; return 0;} 40 int printName(lua_State* L) 41 { 42 printf("Hi i'm object %p ! This is the %i. call.\n",this,callCount); 43 callCount ++; 44 return 0; 45 } 46 47 48 private: 49 int callCount; 50 41 51 }; 42 52 … … 61 71 Lunar<Account>::Register(L); 62 72 Lunar<Object>::Register(L); 63 Object obj(L);64 Lunar<Object>::insertObject(L,&obj,"Object",false);65 73 66 67 74 Object* obj= new Object(L); 75 Lunar<Object>::insertObject(L,obj,"Obj",false); 76 //delete obj; 68 77 69 78 if(argc>1) lua_dofile(L, argv[1]); -
branches/script_engine/src/lib/script_engine/lunar.h
r7963 r7975 118 118 int objectRef = push(L, obj, gc); 119 119 120 lua_pushl iteral(L, "Object");120 lua_pushlstring(L, name.c_str(), name.size()); 121 121 lua_pushvalue(L, objectRef ); 122 122 lua_settable(L, LUA_GLOBALSINDEX ); -
branches/script_engine/src/lib/script_engine/lunartest.lua
r7962 r7975 5 5 end 6 6 7 --o = Object() 8 Object:printName() 7 o = Object() 8 o:printName() 9 10 Obj:printName() 9 11 10 12 a = Account(100)
Note: See TracChangeset
for help on using the changeset viewer.