API:DynamicImageHasTexture
From RoR Wiki
UI Lua API · DynamicImage functions
Version: WAR 1.4.8
Returns whether a DynamicImage has a usable texture.
hasTexture = DynamicImageHasTexture(imageName)
Arguments
- imageName
string– Name of a DynamicImage window.
Returns
- hasTexture
boolean–trueif the image has a texture.
Details
- Once the image has loaded its texture, the result tells whether that load produced a texture.
- Before that, the client looks the image's texture name up and returns
trueif a texture with that name is found. - Both error messages name
DynamicImageSetRotationinstead ofDynamicImageHasTexture.
Errors
Error in function call 'DynamicImageSetRotation': Window %s does not existError in function call 'DynamicImageSetRotation': Window %s is not a DynamicImage
Example
Placing text below an image only when the image has a texture, from ea_tomeofknowledge/source/tomewindow_bestiary.lua:
WindowClearAnchors( "BestiarySpeciesInfoText1" ) if( DynamicImageHasTexture( "BestiarySpeciesInfoImage" ) ) then WindowAddAnchor( "BestiarySpeciesInfoText1", "bottom", "BestiarySpeciesInfoImage", "top", 0, 10 ) else WindowAddAnchor( "BestiarySpeciesInfoText1", "top", "BestiarySpeciesInfoImage", "top", 0, 0 ) end
