Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/SuperOrxoBros_HS18/src/orxonox/scriptablecontroller/luatb_typed_stack.cc @ 12177

Last change on this file since 12177 was 12177, checked in by siramesh, 5 years ago

Super Orxo Bros Final (Sidharth Ramesh, Nisa Balta, Jeff Ren)

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