Changeset 8815 in orxonox.OLD for branches/single_player_map/src/lib/util
- Timestamp:
- Jun 26, 2006, 6:26:21 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/lib/util/executor/executor_lua.h
r8808 r8815 386 386 private: 387 387 ret (T::*functionPointer)(type0, type1); 388 }; 389 390 391 /////////// 392 //// 3 //// 393 /////////// 394 //! Executes a Function with a lua_State* parameter. 395 template<class T, typename ret, typename type0, typename type1, typename type2> class ExecutorLua3ret : public Executor 396 { 397 public: 398 /** 399 * @brief Constructor of a ExecutorXML 400 * @param function a Function to call 401 */ 402 ExecutorLua3ret(ret (T::*function)(type0, type1, type2)) 403 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>()) 404 { 405 this->functionPointer = function; 406 this->functorType = Executor_Objective | Executor_NoLoadString; 407 } 408 409 /** 410 * @brief executes the Command on BaseObject 411 * @param object the BaseObject to execute this Executor on 412 * @param loadString ignored in this case 413 */ 414 virtual void operator()(BaseObject* object, const SubString& = SubString()) const 415 { 416 PRINTF(1)("no usefull executor\n"); 417 } 418 419 virtual void operator()(BaseObject* object, int& count, void* values) const 420 { 421 lua_State* state = (lua_State*)values; 422 count = 0; 423 424 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 425 fromLua<type0>(state, 1), 426 fromLua<type1>(state, 2), 427 fromLua<type2>(state, 3) )); 428 } 429 430 /** 431 * @returns a _new_ Copy of this Executor 432 */ 433 virtual Executor* clone () const 434 { 435 return new ExecutorLua3ret<T, ret, type0, type1, type2>(this->functionPointer); 436 } 437 private: 438 ret (T::*functionPointer)(type0, type1, type2); 388 439 }; 389 440
Note: See TracChangeset
for help on using the changeset viewer.