10 #include <argos3/core/wrappers/lua/lua_utility.h>
19 int LuaSetTarget(lua_State* pt_lua_state) {
21 CCI_PrototypeJointsActuator::SActuator* pc_actuator =
22 reinterpret_cast<CCI_PrototypeJointsActuator::SActuator*
>(lua_touserdata(pt_lua_state, lua_upvalueindex(1)));
24 if(lua_gettop(pt_lua_state) != 1) {
25 std::string strErrMsg =
"robot.joints." + pc_actuator->Id +
".set_target() requires 1 argument";
26 return luaL_error(pt_lua_state, strErrMsg.c_str());
28 luaL_checktype(pt_lua_state, 1, LUA_TNUMBER);
30 pc_actuator->Target = lua_tonumber(pt_lua_state, 1);
39 void CCI_PrototypeJointsActuator::CreateLuaState(lua_State* pt_lua_state) {
44 lua_pushstring(pt_lua_state,
"set_target");
45 lua_pushlightuserdata(pt_lua_state, pc_actuator);
46 lua_pushcclosure(pt_lua_state, &LuaSetTarget, 1);
47 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.
SActuator::TVector m_vecActuators