- Timestamp:
- Jun 14, 2006, 4:26:38 PM (18 years ago)
- Location:
- branches/script_engine/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/script_engine/src/lib/script_engine/script.cc
r8391 r8395 244 244 if(returnCount > 0) 245 245 { 246 if(lua_isnumber(luaState, -1)) 247 { 248 returnValue = (int)lua_tonumber(luaState, -1); 246 if(lua_isnumber(luaState, -1*returnCount)) 247 { 248 returnValue = (int)lua_tonumber(luaState, -1*returnCount); 249 lua_remove(luaState,-1*returnCount); 249 250 returnCount--; 250 lua_pop(luaState,1);251 251 252 } 252 253 } … … 260 261 if(returnCount > 0) 261 262 { 262 if(lua_isboolean(luaState, -1)) 263 { 264 returnValue = (bool)lua_toboolean(luaState, -1); 263 if(lua_isboolean(luaState, -1*returnCount)) 264 { 265 returnValue = (bool)lua_toboolean(luaState, -1*returnCount); 266 lua_remove(luaState,-1*returnCount); 265 267 returnCount--; 266 lua_pop(luaState,1);267 268 } 268 269 } … … 275 276 if(returnCount > 0) 276 277 { 277 if(lua_isnumber(luaState, -1)) 278 { 279 returnValue = (float)lua_tonumber(luaState, -1); 278 if(lua_isnumber(luaState, -1*returnCount)) 279 { 280 returnValue = (float)lua_tonumber(luaState, -1*returnCount); 281 lua_remove(luaState,-1*returnCount); 280 282 returnCount--; 281 lua_pop(luaState,1);282 283 } 283 284 } … … 290 291 if(returnCount > 0) 291 292 { 292 if(lua_isstring(luaState, -1)) 293 { 294 returnValue = lua_tostring(luaState, -1); 293 if(lua_isstring(luaState, -1*returnCount)) 294 { 295 returnValue = lua_tostring(luaState, -1*returnCount); 296 lua_remove(luaState,-1*returnCount); 295 297 returnCount--; 296 lua_pop(luaState,1);297 298 } 298 299 } -
branches/script_engine/src/lunartest2.lua
r8392 r8395 36 36 37 37 --take returnvalue from c 38 callCount = Obj:getCallCount() ()38 callCount = Obj:getCallCount() 39 39 io.write("callCount is now ",callCount) 40 40 io.write("\n") -
branches/script_engine/src/world_entities/script_trigger.cc
r8391 r8395 160 160 script->executeFunction(); 161 161 162 float retf = script->getReturnedFloat(); 163 printf("main returned %f\n",retf); 164 162 int ret = script->getReturnedInt(); 163 printf("main returned %i\n",ret); 165 164 166 165 if(script->getReturnedBool()) … … 169 168 printf("main returned false\n"); 170 169 171 int ret = script->getReturnedInt(); 172 printf("main returned %i\n",ret); 170 float retf = script->getReturnedFloat(); 171 printf("main returned %f\n",retf); 172 173 173 174 174 printf("-------------------------- top of the stack:%i\n",lua_gettop(script->getLuaState()));
Note: See TracChangeset
for help on using the changeset viewer.