Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/util/executor/executor_lua.cc @ 8300

Last change on this file since 8300 was 8271, checked in by bensch, 19 years ago

merge

File size: 1.8 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: ...
13   co-programmer: ...
14*/
15
16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
17
18#include "executor_lua.h"
19
20std::string temp;
21
22template<> bool fromLua<bool>(lua_State* state, int index) { return lua_toboolean(state, index); };
23template<> int fromLua<int>(lua_State* state, int index) { return (int)lua_tonumber(state, index); };
24template<> unsigned int fromLua<unsigned int>(lua_State* state, int index) { return (unsigned int)lua_tonumber(state, index); };
25template<> float fromLua<float>(lua_State* state, int index) { return (float)lua_tonumber(state, index); };
26template<> char fromLua<char>(lua_State* state, int index) { return (char)lua_tonumber(state, index); };
27template<> const std::string& fromLua<const std::string&>(lua_State* state, int index) { temp = lua_tostring(state, index); return temp; };
28
29
30
31template<> void toLua<bool>(lua_State* state, bool value) { lua_pushboolean(state, (int) value); };
32template<> void toLua<int>(lua_State* state, int value)  { lua_pushnumber(state, (lua_Number) value); };
33template<> void toLua<unsigned int>(lua_State* state, unsigned int value){ lua_pushnumber(state, (lua_Number) value); };
34template<> void toLua<float>(lua_State* state, float value) { lua_pushnumber(state, (lua_Number) value); };
35template<> void toLua<char>(lua_State* state, char value) { lua_pushnumber(state, (lua_Number) value); };
36template<> void toLua<const std::string&>(lua_State* state, const std::string& value) {lua_pushstring (state, value.c_str()); }
Note: See TracBrowser for help on using the repository browser.