lua/wrappers/game/lua_body_part.cpp
/**
	 * Sets the type of the body part.
	 *
	 * @param string type The type to set the body part to.
	 * @returns am.body_part This
	 * @returns am.code Return code. Can return either:
	 * <table class='return_codes'>
	 *  <tr><td>success</td><td>The body part type was changed.</td></tr>
	 *  <tr><td>body_part_type_unknown</td><td>The type name was unknown.</td></tr>
	 * </table>
	 */
Sets the type of the body part.
@param string type The type to set the body part to.
Sets the type of the body part . @param string type The type to set the body part to .
int BodyPart_type(lua_State *lua)
	{
		BodyPart *part = castUData<BodyPart>(lua, 1);
		if (part)
		{
			if (lua_gettop(lua) == 1)
			{
				lua_pushstring(lua, BodyPartType::getBodyPartName(part->getType()));
				return 1;
			}
			else if (lua_isstr(lua, 2))
			{
				BodyPartType::PartType type = BodyPartType::getBodyPartType(lua_tostring(lua, 2));
				lua_pushvalue(lua, 1);
				lua_pushinteger(lua, type == BodyPartType::MAX_BODY_TYPE_LENGTH ? base::BODY_PART_TYPE_UNKNOWN : base::SUCCESS);
				return 2;
			}
			return LuaState::expectedArgs(lua, "type", "string type");
		}
		return LuaState::expectedContext(lua, "type", "am.body_part");
	}
int BodyPart_type ( lua_State * lua ) { BodyPart * part = castUData < BodyPart > ( lua , 1 ) ; if ( part ) { if ( lua_gettop ( lua ) == 1 ) { lua_pushstring ( lua , BodyPartType :: getBodyPartName ( part -> getType ( ) ) ) ; return 1 ; } else if ( lua_isstr ( lua , 2 ) ) { BodyPartType :: PartType type = BodyPartType :: getBodyPartType ( lua_tostring ( lua , 2 ) ) ; lua_pushvalue ( lua , 1 ) ; lua_pushinteger ( lua , type == BodyPartType :: MAX_BODY_TYPE_LENGTH ? base :: BODY_PART_TYPE_UNKNOWN : base :: SUCCESS ) ; return 2 ; } return LuaState :: expectedArgs ( lua , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Sets the type of the body part.
Sets the type of the body part .