Changeset 8243 in orxonox.OLD for branches/script_engine/src
- Timestamp:
- Jun 8, 2006, 2:09:20 PM (18 years ago)
- Location:
- branches/script_engine/src/lib/script_engine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/script_engine/src/lib/script_engine/script_trigger.cc
r8239 r8243 121 121 } 122 122 } 123 124 125 void ScriptTrigger::testScriptingFramework() 126 { 127 std::string file("lunartest2.lua"); 128 // Script script; 129 Script* script = ScriptManager::getInstance()->getScriptByFile(file); 130 printf("-------------------------- top of the stack:%i\n",lua_gettop(script->getLuaState())); 131 132 // Register classes with the script 133 // Lunar<Account>::Register(&script); 134 //Lunar<Object>::Register(&script); 135 136 //Object* obj= new Object(); 137 //Account a; 138 //Account *b = new Account(30); 139 140 // Add instances to the script 141 //Lunar<Object>::insertObject(&script,obj,"Obj",true); 142 //Lunar<Account>::insertObject(&script,&a,"a",false); 143 //Lunar<Account>::insertObject(&script,b,"b",true); 144 //printf("-------------------------- top of the stack:%i\n",lua_gettop(script.getLuaState())); 145 146 //Load a file 147 //std::string file("lunartest2.lua"); 148 149 //if(script.loadFile(file)) 150 //printf("File %s succefully loaded\n", file.c_str()); 151 //printf("-------------------------- top of the stack:%i\n",lua_gettop(script.getLuaState())); 152 153 //execute a function 154 printf("----------- main -----------\n"); 155 std::string main("main"); 156 if( script->selectFunction(main,3)) 157 printf("function %s selected\n",main.c_str()); 158 159 script->pushParam(3.14159,main); 160 script->executeFunction(); 161 162 float retf = script->getReturnedFloat(); 163 printf("main returned %f\n",retf); 164 165 166 if(script->getReturnedBool()) 167 printf("main returned true\n"); 168 else 169 printf("main returned false\n"); 170 171 int ret = script->getReturnedInt(); 172 printf("main returned %i\n",ret); 173 174 //printf("-------------------------- top of the stack:%i\n",lua_gettop(script.getLuaState())); 175 //execute a 2nd function 176 printf("----------- test -----------\n"); 177 std::string test("test"); 178 if( script->selectFunction(test,0)) 179 printf("function %s selected\n",test.c_str()); 180 181 script->executeFunction(); 182 183 184 //if(argc>1) lua_dofile(script.getLuaState(), argv[1]); 185 printf("-------------------------- top of the stack:%i\n",lua_gettop(script->getLuaState())); 186 187 } -
branches/script_engine/src/lib/script_engine/script_trigger.h
r8211 r8243 23 23 virtual void tick(float timestep); 24 24 virtual void executeAction(); 25 void testScriptingFramework(); 25 26 26 27 /// SET MEMBER
Note: See TracChangeset
for help on using the changeset viewer.