Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8711 in orxonox.OLD for trunk/src/lib/util


Ignore:
Timestamp:
Jun 22, 2006, 1:09:20 PM (18 years ago)
Author:
bensch
Message:

merged the script_engine back here

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/util/executor/executor_lua.h

    r8527 r8711  
    182182
    183183
     184///////////
     185//// 3 ////
     186///////////
     187//! Executes a Function with a lua_State* parameter.
     188template<class T, typename type0, typename type1, typename type2> class ExecutorLua3 : public Executor
     189{
     190  public:
     191    /**
     192   * @brief Constructor of a ExecutorXML
     193   * @param function a Function to call
     194     */
     195    ExecutorLua3(void(T::*function)(type0, type1, type2))
     196  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
     197    {
     198      this->functionPointer = function;
     199      this->functorType = Executor_Objective | Executor_NoLoadString;
     200    }
     201
     202    /**
     203     * @brief executes the Command on BaseObject
     204     * @param object the BaseObject to execute this Executor on
     205     * @param loadString ignored in this case
     206     */
     207    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
     208    {
     209      PRINTF(1)("no usefull executor\n");
     210    }
     211
     212    virtual void operator()(BaseObject* object, int& count, void* values) const
     213    {
     214      lua_State* state = (lua_State*)values;
     215      count = 0;
     216
     217      (dynamic_cast<T*>(object)->*(functionPointer))(
     218          fromLua<type0>(state, 1),
     219          fromLua<type1>(state, 2),
     220          fromLua<type2>(state, 3) );
     221    }
     222
     223    /**
     224     * @returns a _new_ Copy of this Executor
     225     */
     226    virtual Executor* clone () const
     227    {
     228      return new ExecutorLua3<T, type0, type1, type2>(this->functionPointer);
     229    }
     230  private:
     231    void          (T::*functionPointer)(type0, type1, type2);
     232};
     233
    184234
    185235
     
    209259      this->functorType = Executor_Objective | Executor_NoLoadString;
    210260    }
    211 
     261   
    212262    /**
    213263     * @brief executes the Command on BaseObject
Note: See TracChangeset for help on using the changeset viewer.