lua/wrappers/gfx/lua_asset.cpp
/**
	 * Attempts to add a texture to the list of textures on this asset by texture name.
	 * 
	 * @param string filename The path to load the texture from.
	 * @returns am.asset This
	 * @returns am.code Return code for loading the texture.
	 * <table class='return_codes'>
	 *  <tr><td>success</td><td>The texture loaded the new file successfully.</td></tr>
	 *  <tr><td>file_not_found</td><td>Texture didn't load because the file could not be found.</td></tr>
	 *  <tr><td>texture_load_failed</td><td>Texture didn't load because there was an issue with the file.</td></tr>
	 * </table>
	 */
Attempts to add a texture to the list of textures on this asset by texture name.

@param string filename The path to load the texture from.
@returns am.asset This
@returns am.code Return code for loading the texture.

successThe texture loaded the new file successfully.
file_not_foundTexture didn't load because the file could not be found.
texture_load_failedTexture didn't load because there was an issue with the file.

Attempts to add a texture to the list of textures on this asset by texture name . @param string filename The path to load the texture from . @returns am . asset This @returns am . code Return code for loading the texture . successThe texture loaded the new file successfully . file_not_foundTexture didn ' t load because the file could not be found . texture_load_failedTexture didn ' t load because there was an issue with the file .
int Asset_add_texture(lua_State *lua)
	{
		Asset *asset = castUData<Asset>(lua, 1);
		if (asset)
		{
			if (lua_isstr(lua, 2))
			{
				Texture *texture = nullptr;
				base::ReturnCode result = GfxEngine::getEngine()->getTexture(lua_tostring(lua, 2), texture);
				if (result != base::SUCCESS)
				{
					lua_pushvalue(lua, 1);
					lua_pushinteger(lua, result);
					return 2;
				}
				asset->addTexture(texture);
				lua_first(lua);
			}
			Texture *texture = castUData<Texture>(lua, 2);
			if (texture)
			{
				asset->addTexture(texture);
				lua_pushvalue(lua, 1);
				lua_pushinteger(lua, base::SUCCESS);
				return 2;
			}
			return LuaState::expectedArgs(lua, "add_texture", 2, "am.texture texture", "string filename");
		}
		return LuaState::expectedContext(lua, "add_texture", "am.asset");
	}
int Asset_add_texture ( lua_State * lua ) { Asset * asset = castUData < Asset > ( lua , 1 ) ; if ( asset ) { if ( lua_isstr ( lua , 2 ) ) { Texture * texture = nullptr ; base :: ReturnCode result = GfxEngine :: getEngine ( ) -> getTexture ( lua_tostring ( lua , 2 ) , texture ) ; if ( result != base :: SUCCESS ) { lua_pushvalue ( lua , 1 ) ; lua_pushinteger ( lua , result ) ; return 2 ; } asset -> addTexture ( texture ) ; lua_first ( lua ) ; } Texture * texture = castUData < Texture > ( lua , 2 ) ; if ( texture ) { asset -> addTexture ( texture ) ; lua_pushvalue ( lua , 1 ) ; lua_pushinteger ( lua , base :: SUCCESS ) ; return 2 ; } return LuaState :: expectedArgs ( lua , " " , 2 , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Attempts to add a texture to the list of textures on this asset by texture name.
Attempts to add a texture to the list of textures on this asset by texture name .