Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/util/executor/executor_lua_state.h @ 9743

Last change on this file since 9743 was 9743, checked in by bensch, 18 years ago

orxonox/new_class_id: lua_State executor definition

File size: 2.1 KB
Line 
1/*!
2 * @file executor_generic.h
3 * Definition of a Generic Executor
4 */
5
6/*
7   orxonox - the future of 3D-vertical-scrollers
8
9   Copyright (C) 2004 orx
10
11   This program is free software; you can redistribute it and/or modify
12   it under the terms of the GNU General Public License as published by
13   the Free Software Foundation; either version 2, or (at your option)
14   any later version.
15
16### File Specific:
17   main-programmer: Benjamin Grauer
18   co-programmer: ...
19*/
20
21
22
23#ifndef __EXECUTOR_LUA_STATE_H_
24#define __EXECUTOR_LUA_STATE_H_
25
26
27#include "executor_generic.h"
28#include "luaincl.h"
29
30template<typename type> type fromLua(lua_State* state, int index);
31template<> bool fromLua<bool>(lua_State* state, int index);
32template<> int fromLua<int>(lua_State* state, int index);
33template<> unsigned int fromLua<unsigned int>(lua_State* state, int index);
34template<> float fromLua<float>(lua_State* state, int index);
35template<> char fromLua<char>(lua_State* state, int index);
36template<> const std::string& fromLua<const std::string&>(lua_State* state, int index);
37
38template<typename type> void toLua(lua_State* state, type value);
39template<> void toLua<bool>(lua_State* state, bool value);
40template<> void toLua<int>(lua_State* state, int value);
41template<> void toLua<unsigned int>(lua_State* state, unsigned int value);
42template<> void toLua<float>(lua_State* state, float value);
43template<> void toLua<char>(lua_State* state, char value);
44template<> void toLua<const std::string&>(lua_State* state, const std::string& value);
45
46/**
47 * @brief to remove writing errors, this function is Used.
48 * @param sub The SubString to use
49 * @param default The default Values.
50 */
51template<> class ExecutorEvaluater <lua_State*>
52{
53public:
54  /** @brief Executes the Evaluater
55   * @param CallValue the Value that should be converted
56   * @param defaults the default Values.
57   */
58  template <typename ToType, int index>
59  ToType operator()(lua_State*& CallValue, const MultiType* const defaults)
60  {
61    return (fromLua<ToType>(CallValue, index));
62  }
63  static lua_State*& defaultValue() { static lua_State* nullState; return nullState; };
64};
65
66#endif /* __EXECUTOR_LUA_STATE_H_ */
Note: See TracBrowser for help on using the repository browser.