Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ScriptableController_HS17/src/orxonox/scriptablecontroller/luatb_typed_stack.cc @ 11519

Last change on this file since 11519 was 11519, checked in by kohlia, 7 years ago

See previous

File size: 858 bytes
Line 
1
2#include "luatb_typed_stack.h"
3#include <string>
4
5// Explicit and full specializations need to be in a .cpp file
6
7template<>
8int LuaTBTypedStack::popFromLuaStack<int>(lua_State *lua)
9{ return lua_tointeger(lua, lua_gettop(lua)); }
10
11template<>
12double LuaTBTypedStack::popFromLuaStack<double>(lua_State *lua)
13{ return lua_tonumber(lua, lua_gettop(lua)); }
14
15template<>
16std::string LuaTBTypedStack::popFromLuaStack<std::string>(lua_State *lua)
17{ return lua_tostring(lua, lua_gettop(lua)); }
18
19template<>
20void LuaTBTypedStack::pushToLuaStack<int>(lua_State *lua, int value)
21{ lua_pushinteger(lua, value); }
22
23template<>
24void LuaTBTypedStack::pushToLuaStack<double>(lua_State *lua, double value)
25{ lua_pushnumber(lua, value); }
26
27template<>
28void LuaTBTypedStack::pushToLuaStack<std::string>(lua_State *lua, std::string value)
29{ lua_pushstring(lua, value.c_str()); }
Note: See TracBrowser for help on using the repository browser.