Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9727 in orxonox.OLD for branches/new_class_id/src/lib/script_engine


Ignore:
Timestamp:
Sep 14, 2006, 5:24:31 PM (18 years ago)
Author:
bensch
Message:

orxonox/new_class_id: new Executor construct, that is much more typesafe, faster, and easier to extend…

Also changed the LoadParam process, and adapted ScriptEngine calls

Then at the end, some missing headers appeared, and appended them to all the cc-files again.

Location:
branches/new_class_id/src/lib/script_engine
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/script_engine/lunar.h

    r8408 r9727  
    1616  userdataType;
    1717public:
    18   typedef Executor* mfp;
     18  typedef Executor<lua_State*>* mfp;
    1919  typedef struct { const char *name; mfp mfunc; }
    2020  RegType;
     
    184184    lua_remove(L, 1);  // remove self so member function args start at index 1
    185185    // get member function from upvalue
    186     Executor *l = static_cast<Executor*>(lua_touserdata(L, lua_upvalueindex(1)));
    187     int value;
    188     (*l)(obj, value, L);  // call member function
    189     return value;
     186    mfp l = static_cast<mfp>(lua_touserdata(L, lua_upvalueindex(1)));
     187    (*l)(obj, L);  // call member function
     188    return l->hasRetVal()? 1 : 0;
    190189  }
    191190
  • branches/new_class_id/src/lib/script_engine/script_manager.cc

    r9715 r9727  
    2727#include "script_trigger.h"
    2828#include "luaincl.h"
    29 #include "loading/load_param.h"
    30 #include "parser/tinyxml/tinyxml.h"
     29#include "loading/load_param_xml.h"
    3130
    3231
  • branches/new_class_id/src/lib/script_engine/script_method.cc

    r8711 r9727  
    2525{ }
    2626
    27 ScriptMethod* ScriptMethod::addMethod(const std::string& methodName, const Executor& executor)
     27ScriptMethod* ScriptMethod::addMethod(const std::string& methodName, const Executor<lua_State*>& executor)
    2828{
    2929  this->methods.push_back(ScriptMethod::Method(methodName, executor));
     
    3232}
    3333
    34 ScriptMethod::Method::Method(const std::string& name, const Executor& executor)
     34ScriptMethod::Method::Method(const std::string& name, const Executor<lua_State*>& executor)
    3535{
    3636  this->name = name;
  • branches/new_class_id/src/lib/script_engine/script_method.h

    r8711 r9727  
    1818  ~ScriptMethod();
    1919
    20   ScriptMethod* addMethod(const std::string& methodName, const Executor& executor);
     20  ScriptMethod* addMethod(const std::string& methodName, const Executor<lua_State*>& executor);
    2121
    2222  unsigned int size() const { return methods.size(); };
    2323
    2424  const std::string& name(unsigned int methodNumber) const { return methods[methodNumber].name; };
    25   const Executor* executor(unsigned int methodNumber) const { return methods[methodNumber].executor; };
     25  const Executor<lua_State*>* executor(unsigned int methodNumber) const { return methods[methodNumber].executor; };
    2626
    2727
     
    2929  struct Method
    3030  {
    31     Method(const std::string& name, const Executor& executor);
    32     std::string    name;
    33     Executor*      executor;
     31    Method(const std::string& name, const Executor<lua_State*>& executor);
     32    std::string             name;
     33    Executor<lua_State*>*   executor;
    3434  };
    3535
Note: See TracChangeset for help on using the changeset viewer.