Thread Tools Display Modes
11-18-13, 05:55 AM   #1
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
SetTexture

"xyz" attempt to call method "SetTexture" (a nil value).

How is this even possible?

Lua Code:
  1. if SetTexture then
  2.     texture:SetTexture("texturefile")
  3. end

...fixes it.
  Reply With Quote
11-18-13, 07:27 AM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
That doesn't explain anything, you need to post more of your code.
You will get that message if you try to call SetTexture on a region that is not a texture (some kind of frame?) or on a reference that hasn't yet been instantiated.
  Reply With Quote
11-18-13, 07:38 AM   #3
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
I fixed it now, the problem seems to be was in the texturefile.
Which is weird because it should have thrown a different error then.

Last edited by Resike : 11-18-13 at 07:41 AM.
  Reply With Quote
11-18-13, 11:53 AM   #4
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
Originally Posted by Resike View Post
Lua Code:
  1. if type(texture.SetTexture) == 'function' then
  2.     texture:SetTexture("texturefile")
  3. end
fixed the fix. You could probably also use "UIObject:IsObjectType('Texture')" but that would imply you already know the variable is an instance of UIObject

If a texturefile is corrupt or can not be loaded it's usually green, but I can't remember SetTexture() ever thrown an error because of it :S

Last edited by ravagernl : 11-18-13 at 11:55 AM.
  Reply With Quote
11-18-13, 02:27 PM   #5
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by ravagernl View Post
fixed the fix. You could probably also use "UIObject:IsObjectType('Texture')" but that would imply you already know the variable is an instance of UIObject

If a texturefile is corrupt or can not be loaded it's usually green, but I can't remember SetTexture() ever thrown an error because of it :S
Hmm yeah i didn't thought about using "IsObjectType('Texture')".
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » SetTexture


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off