Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8104 in orxonox.OLD for branches/script_engine/src/lib


Ignore:
Timestamp:
Jun 1, 2006, 10:12:43 PM (18 years ago)
Author:
snellen
Message:

did some cleanup and added getFileName function to script

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

Legend:

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

    r8103 r8104  
    2828    const char Account::className[] = "Account";
    2929
    30 
    31     #define method(class, name) {#name, &class::name}
    32 
    3330    Lunar<Account>::RegType Account::methods[] = {
    3431      {"deposit", new ExecutorLua1<Account, float>(&Account::deposit)},
     
    4845        ~Object() { printf("deleted Object (%p)\n", this); }
    4946
    50         //lua Interface
    51         //function that returns a value to lua
    52         int getCallCount(lua_State* L)
    53         {
    54          int calls = getCallCount();
    55          lua_pushnumber(L,(lua_Number)calls);
    56          return 1; // return number of values that the function wants to return to lua
    57         }
    58 
    59          //function that takes an argument from lua
    60          int takeParam(lua_State* L)
    61          {
    62           int param = (int)lua_tonumber(L,-1);
    63           takeParam(param);
    64           return 0;
    65          }
    66 
    67         //meber functions
    6847        void takeParam(int i)
    6948        {
  • branches/script_engine/src/lib/script_engine/lunartest2.lua

    r8085 r8104  
    3636  io.write("callCount is now ",callCount)
    3737  io.write("\n")
    38  
     38
    3939  --pass parameters to a c++ method
    4040  Obj:takeParam(3)
     
    5151
    5252  return 2,false,2.72
     53
    5354  --debug.debug()
    5455end
  • branches/script_engine/src/lib/script_engine/script.h

    r8093 r8104  
    1616
    1717    bool loadFile(std::string& filename);
     18    std::string getFileName(){return currentFile;}
    1819    bool executeFile();
    1920
Note: See TracChangeset for help on using the changeset viewer.