Changeset 8830 in orxonox.OLD for branches/single_player_map/src
- Timestamp:
- Jun 27, 2006, 3:37:07 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/lib/util/executor/executor_lua.h
r8829 r8830 489 489 private: 490 490 ret (T::*functionPointer)(type0, type1, type2, type3); 491 }; 492 493 /////////// 494 //// 5 //// 495 /////////// 496 //! Executes a Function with a lua_State* parameter. 497 template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4> class ExecutorLua5ret : public Executor 498 { 499 public: 500 /** 501 * @brief Constructor of a ExecutorXML 502 * @param function a Function to call 503 */ 504 ExecutorLua5ret(ret (T::*function)(type0, type1, type2, type3, type4)) 505 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>()) 506 { 507 this->functionPointer = function; 508 this->functorType = Executor_Objective | Executor_NoLoadString; 509 } 510 511 /** 512 * @brief executes the Command on BaseObject 513 * @param object the BaseObject to execute this Executor on 514 * @param loadString ignored in this case 515 */ 516 virtual void operator()(BaseObject* object, const SubString& = SubString()) const 517 { 518 PRINTF(1)("no usefull executor\n"); 519 } 520 521 virtual void operator()(BaseObject* object, int& count, void* values) const 522 { 523 lua_State* state = (lua_State*)values; 524 count = 1; 525 526 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 527 fromLua<type0>(state, 1), 528 fromLua<type1>(state, 2), 529 fromLua<type2>(state, 3), 530 fromLua<type3>(state, 4), 531 fromLua<type4>(state, 5) )); 532 } 533 534 /** 535 * @returns a _new_ Copy of this Executor 536 */ 537 virtual Executor* clone () const 538 { 539 return new ExecutorLua5ret<T, ret, type0, type1, type2, type3, type4>(this->functionPointer); 540 } 541 private: 542 ret (T::*functionPointer)(type0, type1, type2, type3, type4); 491 543 }; 492 544 … … 588 640 fromLua<type3>(state, 4), 589 641 fromLua<type4>(state, 5), 590 fromLua<type 4>(state, 6),591 fromLua<type 5>(state, 7) ));642 fromLua<type5>(state, 6), 643 fromLua<type6>(state, 7) )); 592 644 } 593 645
Note: See TracChangeset
for help on using the changeset viewer.