lua/wrappers/gfx/lua_sprite.cpp
/**
	 * Sets the asset name for this sprite to use.
	 *
	 * @param string asset_name The name of the asset to use.
	 * @returns am.sprite This
	 */
Sets the asset name for this sprite to use.
@param string asset_name The name of the asset to use.
Sets the asset name for this sprite to use . @param string asset_name The name of the asset to use .
int Sprite_asset(lua_State *lua)
	{
		Sprite *sprite = castUData<Sprite>(lua, 1);
		if (sprite)
		{
			if (lua_gettop(lua) == 1)
			{
				base::Handle<Asset> asset(sprite->getAsset());
				if (asset)
				{
					lua_pushstring(lua, asset->getName());
					return 1;
				}
				lua_pushstring(lua, "");
				return 1;
			}
			else if (lua_isstr(lua, 2))
			{
				sprite->setAsset(lua_tostring(lua, 2));
				lua_first(lua);
			}
			return LuaState::expectedArgs(lua, "asset", "string asset_name");
		}
		return LuaState::expectedContext(lua, "asset", "am.sprite");
	}
int Sprite_asset ( lua_State * lua ) { Sprite * sprite = castUData < Sprite > ( lua , 1 ) ; if ( sprite ) { if ( lua_gettop ( lua ) == 1 ) { base :: Handle < Asset > asset ( sprite -> getAsset ( ) ) ; if ( asset ) { lua_pushstring ( lua , asset -> getName ( ) ) ; return 1 ; } lua_pushstring ( lua , " " ) ; return 1 ; } else if ( lua_isstr ( lua , 2 ) ) { sprite -> setAsset ( lua_tostring ( lua , 2 ) ) ; lua_first ( lua ) ; } return LuaState :: expectedArgs ( lua , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Sets the asset name for this sprite to use.
Sets the asset name for this sprite to use .