Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8395 in orxonox.OLD


Ignore:
Timestamp:
Jun 14, 2006, 4:26:38 PM (18 years ago)
Author:
snellen
Message:

changed order of returnvalues of the get… functions in script

Location:
branches/script_engine/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/script_engine/src/lib/script_engine/script.cc

    r8391 r8395  
    244244   if(returnCount > 0)
    245245   {
    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);
    249250       returnCount--;
    250        lua_pop(luaState,1);
     251       
    251252     }
    252253   }
     
    260261   if(returnCount > 0)
    261262   {
    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);
    265267       returnCount--;
    266        lua_pop(luaState,1);
    267268     }
    268269   }
     
    275276   if(returnCount > 0)
    276277   {
    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);
    280282       returnCount--;
    281        lua_pop(luaState,1);
    282283     }
    283284   }
     
    290291   if(returnCount > 0)
    291292   {
    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);
    295297       returnCount--;
    296        lua_pop(luaState,1);
    297298     }
    298299   }
  • branches/script_engine/src/lunartest2.lua

    r8392 r8395  
    3636
    3737  --take returnvalue from c
    38   callCount = Obj:getCallCount()()
     38  callCount = Obj:getCallCount()
    3939  io.write("callCount is now ",callCount)
    4040  io.write("\n")
  • branches/script_engine/src/world_entities/script_trigger.cc

    r8391 r8395  
    160160   script->executeFunction();
    161161
    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);
    165164
    166165   if(script->getReturnedBool())
     
    169168     printf("main returned false\n");
    170169
    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   
    173173
    174174   printf("-------------------------- top of the stack:%i\n",lua_gettop(script->getLuaState()));
Note: See TracChangeset for help on using the changeset viewer.