lua/wrappers/game/lua_item.cpp
/**
	 * Sets the item type, can be one of the following values:
	 * <ul>
	 * <li>helm</li><li>body</li><li>sword</li><li>axe</li><li>bow</li>
	 * <li>ring</li><li>amulet</li><li>leggins</li><li>boots</li><li>shield</li>
	 * <li>potion</li><li>gold</li><li>unknown</li>
	 * </ul>
	 *
	 * @param string item_type The item type to set on this item.
	 * @returns am.item This
	 */
Sets the item type, can be one of the following values:

helmbodyswordaxebow
ringamuletlegginsbootsshield
potiongoldunknown


@param string item_type The item type to set on this item.
Sets the item type can be one of the following values : helmbodyswordaxebow ringamuletlegginsbootsshield potiongoldunknown @param string item_type The item type to set on this item .
int Item_item_type(lua_State *lua)
	{
		Item *item = castUData<Item>(lua, 1);
		if (item)
		{
			if (lua_gettop(lua) == 1)
			{
				const char *name = item->getItemTypeName();
				if (name != nullptr)
				{
					lua_pushstring(lua, name);
					return 1;
				}
				lua_pushstring(lua, "");
				return 1;
			}
			else
			{
				ItemCommon::ItemType type = ItemCommon::UNKNOWN;
				if (lua_isnum(lua, 2))
				{
					type = ItemCommon::getItemType(lua_tointeger(lua, 2));
				}
				else if (lua_isstr(lua, 2))
				{
					type = ItemCommon::getItemType(lua_tostring(lua, 2));
				}
				else
				{
					return LuaState::expectedArgs(lua, "item_type", 2, "string type_name", "integer type_id");
				}
				if (type != ItemCommon::UNKNOWN)
				{
					item->setItemType(type);
				}
				else
				{
					std::stringstream ss;
					ss << "Unknown item type: ";
					LuaState::printTypeValue(lua, 2, ss);
					LuaState::warning(lua, ss.str().c_str());
				}
				lua_first(lua);
			}
		}
		return LuaState::expectedContext(lua, "item_type", "item");
	}
int Item_item_type ( lua_State * lua ) { Item * item = castUData < Item > ( lua , 1 ) ; if ( item ) { if ( lua_gettop ( lua ) == 1 ) { const char * name = item -> getItemTypeName ( ) ; if ( name != nullptr ) { lua_pushstring ( lua , name ) ; return 1 ; } lua_pushstring ( lua , " " ) ; return 1 ; } else { ItemCommon :: ItemType type = ItemCommon :: UNKNOWN ; if ( lua_isnum ( lua , 2 ) ) { type = ItemCommon :: getItemType ( lua_tointeger ( lua , 2 ) ) ; } else if ( lua_isstr ( lua , 2 ) ) { type = ItemCommon :: getItemType ( lua_tostring ( lua , 2 ) ) ; } else { return LuaState :: expectedArgs ( lua , " " , 2 , " " , " " ) ; } if ( type != ItemCommon :: UNKNOWN ) { item -> setItemType ( type ) ; } else { std :: stringstream ss ; ss << " " ; LuaState :: printTypeValue ( lua , 2 , ss ) ; LuaState :: warning ( lua , ss . str ( ) . c_str ( ) ) ; } lua_first ( lua ) ; } } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Sets the item type, can be one of the following values:
 <ul>
 <li>helm</li><li>body</li><li>sword</li><li>axe</li><li>bow</li>
 <li>ring</li><li>amulet</li><li>leggins</li><li>boots</li><li>shield</li>
 <li>potion</li><li>gold</li><li>unknown</li>
 </ul>
Sets the item type can be one of the following values : <ul > <li > helm< / li > <li > body< / li > <li > sword< / li > <li > axe< / li > <li > bow< / li > <li > ring< / li > <li > amulet< / li > <li > leggins< / li > <li > boots< / li > <li > shield< / li > <li > potion< / li > <li > gold< / li > <li > unknown< / li > < / ul >