lua/wrappers/game/lua_tile.cpp
/**
	 * Sets and adds the tile to the given tile set.
	 * Any tile with the same name in the tile set will be overridden by this tile.
	 * Unless the 'check_for_existing' argument is set to true, then if the tileset already has
	 * a tile with the same name then tile set is not changed.
	 *
	 * @param TileSet set The tile set to add to, can be nil.
	 * @param boolean [false] check_for_existing When true the tile set will not be changed if it 
	 *  already has a tile with the same name.
	 * @returns boolean True if the tile set was changed.
	 */
Sets and adds the tile to the given tile set.
Any tile with the same name in the tile set will be overridden by this tile.
Unless the 'check_for_existing' argument is set to true, then if the tileset already has
a tile with the same name then tile set is not changed.

@param TileSet set The tile set to add to, can be nil.
@param boolean [false] check_for_existing When true the tile set will not be changed if it
already has a tile with the same name.
@returns boolean True if the tile set was changed.
Sets and adds the tile to the given tile set . Any tile with the same name in the tile set will be overridden by this tile . Unless the ' check_for_existing ' argument is set to true then if the tileset already has a tile with the same name then tile set is not changed . @param TileSet set The tile set to add to can be nil . @param boolean [ false ] check_for_existing When true the tile set will not be changed if it already has a tile with the same name . @returns boolean True if the tile set was changed .
int Tile_tile_set(lua_State *lua)
	{
		Tile *tile = castUData<Tile>(lua, 1);
		if (tile)
		{
			int args = lua_gettop(lua);
			if (args == 1)
			{
				if (tile->getTileSet())
				{
					wrapRefObject<TileSet>(lua, tile->getTileSet());
					return 1;
				}
				lua_pushnil(lua);
				return 1;
			}
			else
			{
				TileSet *set = castUData<TileSet>(lua, 2);
				if (set)
				{
					bool withCheck = false;
					if (args == 3)
					{
						withCheck = lua_tobool(lua, 3);
					}
					if (withCheck)
					{
						if (set->addTileWithCheck(tile))
						{
							tile->setTileSet(set);
							lua_pushboolean(lua, 1);
							return 1;
						}
						lua_pushboolean(lua, 0);
						return 1;
					}
					else
					{
						tile->setTileSet(set);
						set->addTile(tile);
						lua_pushboolean(lua, 1);
						return 1;
					}
				}
				else
				{
					tile->setTileSet(set);
					lua_pushboolean(lua, 1);
					return 1;
				}
			}
			return LuaState::expectedArgs(lua, "tile_set", "am.tile_set tileSet, boolean [false] check_for_existing");
		}
		return LuaState::expectedContext(lua, "tile_set", "am.tile");
	}
int Tile_tile_set ( lua_State * lua ) { Tile * tile = castUData < Tile > ( lua , 1 ) ; if ( tile ) { int args = lua_gettop ( lua ) ; if ( args == 1 ) { if ( tile -> getTileSet ( ) ) { wrapRefObject < TileSet > ( lua , tile -> getTileSet ( ) ) ; return 1 ; } lua_pushnil ( lua ) ; return 1 ; } else { TileSet * set = castUData < TileSet > ( lua , 2 ) ; if ( set ) { bool withCheck = false ; if ( args == 3 ) { withCheck = lua_tobool ( lua , 3 ) ; } if ( withCheck ) { if ( set -> addTileWithCheck ( tile ) ) { tile -> setTileSet ( set ) ; lua_pushboolean ( lua , 1 ) ; return 1 ; } lua_pushboolean ( lua , 0 ) ; return 1 ; } else { tile -> setTileSet ( set ) ; set -> addTile ( tile ) ; lua_pushboolean ( lua , 1 ) ; return 1 ; } } else { tile -> setTileSet ( set ) ; lua_pushboolean ( lua , 1 ) ; return 1 ; } } return LuaState :: expectedArgs ( lua , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Sets and adds the tile to the given tile set.
Sets and adds the tile to the given tile set .
// If a non-nil tile set has been passed in. // Checking for existing tiles with the same name. // Just replace any tile with the same name. // The given tile set was nil, so there's nothing to check.