lua/wrappers/game/lua_tile.cpp
/**
	 * Sets the name of the tile.
	 * If there already exists a tile with the same name, it will be overridden
	 * by this tile if the 'check_for_existing' argument is not true.
	 *
	 * @param string name The new name for this tile.
	 * @param boolean [false] check_for_existing When true the name will be not changed if there
	 *  is already a tile with the same name in the tile's tile set.
	 * @returns boolean True if the tile's name was changed.
	 */
Sets the name of the tile.
If there already exists a tile with the same name, it will be overridden
by this tile if the 'check_for_existing' argument is not true.

@param string name The new name for this tile.
@param boolean [false] check_for_existing When true the name will be not changed if there
is already a tile with the same name in the tile's tile set.
@returns boolean True if the tile's name was changed.
Sets the name of the tile . If there already exists a tile with the same name it will be overridden by this tile if the ' check_for_existing ' argument is not true . @param string name The new name for this tile . @param boolean [ false ] check_for_existing When true the name will be not changed if there is already a tile with the same name in the tile ' s tile set . @returns boolean True if the tile ' s name was changed .
int Tile_name(lua_State *lua)
	{
		Tile *tile = castUData<Tile>(lua, 1);
		if (tile)
		{
			int args = lua_gettop(lua);
			if (args == 1)
			{
				lua_pushstring(lua, tile->getName().c_str());
				return 1;
			}
			else if (lua_isstr(lua, 2))
			{
				bool checkForExisting = false;
				bool valid = true;
				if (args >= 3)
				{
					if (lua_isbool(lua, 3))
					{
						checkForExisting = lua_tobool(lua, 3);
					}
					else
					{
						valid = false;
					}
				}
				if (checkForExisting)
				{
					lua_pushboolean(lua, tile->setNameWithCheck(lua_tostring(lua, 2)));
					return 1;
				}
				if (valid)
				{
					tile->setName(lua_tostring(lua, 2));
					lua_pushboolean(lua, 1);
					return 1;
				}
			}
			return LuaState::expectedArgs(lua, "name", "string name, boolean [false] check_for_existing");
		}
		return LuaState::expectedContext(lua, "name", "am.tile");
	}
int Tile_name ( lua_State * lua ) { Tile * tile = castUData < Tile > ( lua , 1 ) ; if ( tile ) { int args = lua_gettop ( lua ) ; if ( args == 1 ) { lua_pushstring ( lua , tile -> getName ( ) . c_str ( ) ) ; return 1 ; } else if ( lua_isstr ( lua , 2 ) ) { bool checkForExisting = false ; bool valid = true ; if ( args >= 3 ) { if ( lua_isbool ( lua , 3 ) ) { checkForExisting = lua_tobool ( lua , 3 ) ; } else { valid = false ; } } if ( checkForExisting ) { lua_pushboolean ( lua , tile -> setNameWithCheck ( lua_tostring ( lua , 2 ) ) ) ; return 1 ; } if ( valid ) { tile -> setName ( lua_tostring ( lua , 2 ) ) ; lua_pushboolean ( lua , 1 ) ; return 1 ; } } return LuaState :: expectedArgs ( lua , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Sets the name of the tile.
Sets the name of the tile .