/*! * @file executor_generic.h * Definition of a Generic Executor */ /* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Benjamin Grauer co-programmer: ... */ #ifndef __EXECUTOR_LUA_STATE_H_ #define __EXECUTOR_LUA_STATE_H_ #include "executor_generic.h" #include "luaincl.h" #ifdef FUNCTOR_CALL_TYPE #undef FUNCTOR_CALL_TYPE #endif #define FUNCTOR_CALL_TYPE lua_State* template type fromLua(lua_State* state, int index); template<> bool fromLua(lua_State* state, int index); template<> int fromLua(lua_State* state, int index); template<> unsigned int fromLua(lua_State* state, int index); template<> float fromLua(lua_State* state, int index); template<> char fromLua(lua_State* state, int index); template<> const std::string& fromLua(lua_State* state, int index); template void toLua(lua_State* state, type value); template<> void toLua(lua_State* state, bool value); template<> void toLua(lua_State* state, int value); template<> void toLua(lua_State* state, unsigned int value); template<> void toLua(lua_State* state, float value); template<> void toLua(lua_State* state, char value); template<> void toLua(lua_State* state, const std::string& value); /** * @brief to remove writing errors, this function is Used. * @param sub The SubString to use * @param default The default Values. */ template<> class ExecutorEvaluater { public: /** @brief Executes the Evaluater * @param CallValue the Value that should be converted * @param defaults the default Values. */ template ToType operator()(lua_State*& CallValue, const MultiType* const defaults) { return (fromLua(CallValue, index)); } template void storeRet(lua_State*& state, ToType value) { toLua(state, value); } static lua_State*& defaultValue() { static lua_State* nullState; return nullState; }; }; #endif /* __EXECUTOR_LUA_STATE_H_ */