Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8128 in orxonox.OLD for branches/script_engine/src


Ignore:
Timestamp:
Jun 3, 2006, 3:32:09 PM (18 years ago)
Author:
snellen
Message:

Cleaned up Object, added comments in luatestscript2.lua

Location:
branches/script_engine/src/lib/script_engine
Files:
2 edited

Legend:

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

    r8105 r8128  
    4444        Object(){callCount = 0;};
    4545        ~Object() { printf("deleted Object (%p)\n", this); }
    46 
    47         //lua Interface
    48         //function that returns a value to lua
    49         int getCallCount(lua_State* L)
    50         {
    51          int calls = getCallCount();
    52          lua_pushnumber(L,(lua_Number)calls);
    53          return 1; // return number of values that the function wants to return to lua
    54         }
    55 
    56          //function that takes an argument from lua
    57          int takeParam(lua_State* L)
    58          {
    59           int param = (int)lua_tonumber(L,-1);
    60           takeParam(param);
    61           return 0;
    62          }
    6346
    6447        //meber functions
     
    11497      Lunar<Account>::insertObject(&script,b,"b",true);
    11598       printf("-------------------------- top of the stack:%i\n",lua_gettop(script.getLuaState()));
     99
    116100      //Load a file
    117101      std::string file(argv[1]);
     
    120104        printf("File %s succefully loaded\n", file.c_str());
    121105      printf("-------------------------- top of the stack:%i\n",lua_gettop(script.getLuaState()));
     106
    122107      //execute a function
    123108      printf("----------- main -----------\n");
  • branches/script_engine/src/lib/script_engine/lunartest2.lua

    r8104 r8128  
    2222
    2323function main(arg)
     24  -- use parameter
    2425  io.write("main received ", arg)
    2526  io.write(" as parameter\n")
    26   --call member
     27
     28  --call member of an inserted object
    2729  Obj:printName()
    2830
    29   --create object
    30 
     31  --create object of a registered type
    3132  o = Object()
    3233  o:printName()
Note: See TracChangeset for help on using the changeset viewer.