lua/wrappers/game/lua_tile.cpp
/**
	 * Adds a tile type to the list of tile types.
	 * If a type is already in the list, it will be ignored.
	 * 
	 * @param string... tile_type_name The name of the tile type to add to the list.
	 * @returns am.tile This
	 */
Adds a tile type to the list of tile types.
If a type is already in the list, it will be ignored.

@param string... tile_type_name The name of the tile type to add to the list.
Adds a tile type to the list of tile types . If a type is already in the list it will be ignored . @param string ... tile_type_name The name of the tile type to add to the list .
int Tile_add_tile_type(lua_State *lua)
	{
		Tile *tile = castUData<Tile>(lua, 1);
		if (tile)
		{
			int args = lua_gettop(lua);
			std::vector< base::Handle<TileType> > types;
			types.reserve(args - 2);
			bool error = false;
			for (int i = 2; i <= args; i++)
			{
				TileType *tileType(getTileType(lua, i));
				if (tileType)
				{
					types.push_back(tileType);
				}
				else if (!lua_isstr(lua, i))
				{
					error = true;
					break;
				}
				else
				{
					std::stringstream ss;
					ss << "Unable to find tile type: " << lua_tostring(lua, i);
					LuaState::warning(lua, ss.str().c_str());
				}
			}
			if (!error)
			{
				for (size_t i = 0; i < types.size(); i++)
				{
					tile->addTileType(types[i]);
				}
				lua_first(lua);
			}
			return LuaState::expectedArgs(lua, "add_tile_type", "am.tile_type/string... tile_type");
		}
		return LuaState::expectedContext(lua, "add_tile_type", "am.tile");
	}
int Tile_add_tile_type ( lua_State * lua ) { Tile * tile = castUData < Tile > ( lua , 1 ) ; if ( tile ) { int args = lua_gettop ( lua ) ; std :: vector < base :: Handle < TileType > > types ; types . reserve ( args - 2 ) ; bool error = false ; for ( int i = 2 ; i <= args ; i ++ ) { TileType * tileType ( getTileType ( lua , i ) ) ; if ( tileType ) { types . push_back ( tileType ) ; } else if ( ! lua_isstr ( lua , i ) ) { error = true ; break ; } else { std :: stringstream ss ; ss << " " << lua_tostring ( lua , i ) ; LuaState :: warning ( lua , ss . str ( ) . c_str ( ) ) ; } } if ( ! error ) { for ( size_t i = 0 ; i < types . size ( ) ; i ++ ) { tile -> addTileType ( types [ i ] ) ; } lua_first ( lua ) ; } return LuaState :: expectedArgs ( lua , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Adds a tile type to the list of tile types.
Adds a tile type to the list of tile types .