Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
May 24, 2006, 5:56:07 PM (19 years ago)
Author:
snellen
Message:

moved old files

Location:
branches/script_engine/src/lib/script_engine
Files:
1 added
1 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/script_engine/src/lib/script_engine/luna.h

    r7815 r7820  
    1919 public:
    2020   /* member function map */
    21    struct RegType { 
    22       const char* name; 
     21   struct RegType {
     22      const char* name;
    2323      int(T::*mfunc)(lua_State*);
    24    };     
     24   };
    2525   /* register class T */
    2626   static void Register(lua_State* L) {
     
    3030
    3131     /* if (otag == 0) {
    32         otag = lua_newtag(L);
    33         lua_pushcfunction(L, &Luna<T>::gc_obj);
    34         lua_settagmethod(L, otag, "gc"); /* tm to release objects
     32        otag = lua_newtag(L);
     33        lua_pushcfunction(L, &Luna<T>::gc_obj);
     34        lua_settagmethod(L, otag, "gc"); /* tm to release objects
    3535      }*/
    3636   }
     
    3838 private:
    3939   static int otag; /* object tag */
    40    
     40
    4141   /* member function dispatcher */
    4242   static int thunk(lua_State* L) {
    4343      /* stack = closure(-1), [args...], 'self' table(1) */
    4444      //int i = static_cast<int>(lua_tonumber(L,-1));
    45  
     45
    4646       int i = lua_upvalueindex (1);
    4747
     
    5252      lua_pop(L, 1); /* pop closure value and obj */
    5353
    54         printf("FUNCTION:: %d\n", i );
     54        printf("FUNCTION:: %d\n", i );
    5555        printf("OBJECT %p\n", obj);
    5656
     
    5858      return (obj->*(T::Register[i].mfunc))(L);
    5959   }
    60    
     60
    6161
    6262    static int setScriptable(T* obj)
     
    6464     //return registerObject(obj);
    6565     }
    66    
     66
    6767   static int setScriptable(const std::string& objectName)
    6868    {
    69    #warning 'implement do not use'
     69   //#warning 'implement do not use'
    7070  //   return registerObject(obj);
    7171    }
     
    8686      return 0;
    8787   }
    88  protected: 
     88 protected:
    8989   Luna(); /* hide default constructor */
    9090
     
    104104      //std::cout<<"test"<<std::endl;
    105105
    106     /* Set up garbage collection 
     106    /* Set up garbage collection
    107107      if(lua_getmetatable(L, objRef) != 0)
    108108       {
     
    115115      //lua_rawgeti (L, LUA_REGISTRYINDEX, objRef);
    116116      /* register the member functions */
    117       for (int i=0; T::Register[i].name; i++) 
     117      for (int i=0; T::Register[i].name; i++)
    118118      {
    119         lua_pushstring(L, T::Register[i].name);
    120         lua_pushnumber(L, i);
    121         lua_pushcclosure(L, &Luna<T>::thunk, 1);
    122         lua_settable(L,-3);
     119        lua_pushstring(L, T::Register[i].name);
     120        lua_pushnumber(L, i);
     121        lua_pushcclosure(L, &Luna<T>::thunk, 1);
     122        lua_settable(L,-3);
    123123      }
    124124      return 1; /* return the table object */
Note: See TracChangeset for help on using the changeset viewer.