10 #include <argos3/core/wrappers/lua/lua_utility.h>
26 int LuaSetCurrent(lua_State* pt_lua_state) {
31 if(lua_gettop(pt_lua_state) != 1) {
32 std::string strErrMsg =
"robot.magnets." + ps_interface->
Id +
".set_current() requires 1 argument";
33 return luaL_error(pt_lua_state, strErrMsg.c_str());
35 luaL_checktype(pt_lua_state, 1, LUA_TNUMBER);
37 ps_interface->
Current = lua_tonumber(pt_lua_state, 1);
46 void CCI_MagnetsActuator::CreateLuaState(lua_State* pt_lua_state) {
51 lua_pushstring(pt_lua_state,
"set_current");
52 lua_pushlightuserdata(pt_lua_state, &s_interface);
53 lua_pushcclosure(pt_lua_state, &LuaSetCurrent, 1);
54 lua_settable(pt_lua_state, -3);
The namespace containing all the ARGoS related code.
static void EndTable(lua_State *pt_state)
Adds a table to the Lua stack.
static void StartTable(lua_State *pt_state, const std::string &str_key)
Adds a table with the given string key to the table located at the top of the stack.
SInterface::TVector & GetInterfaces()
Returns a reference to the magnet interfaces.
SInterface::TVector m_vecInterfaces
std::vector< SInterface > TVector