-
jduartedj
- Posts: 599
- Joined: Sat Dec 19, 2009 12:18 am
- Location: Lisbon
-
Contact:
#1
Post
by jduartedj » Wed Jan 19, 2011 7:39 am
I'd like to know how to detect if a certain user function is installed because if it isn't then an error comes up but doing:
Code: Select all
if gameText then
gameText("I exist","WARNING")
end
doesn't make it because the function returns nil anyway isn't it?
is there a variable with all the installed user functions? like settings.addons["gameText"] or settings.uf["gameText"] ? that records either the uf file names or the function names themselves?
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#2
Post
by rock5 » Wed Jan 19, 2011 1:20 pm
No, that should work. The only time a value will return false is if it is "false" or "nil". A function is not nil. You don't have to worry about what the function returns because you are not executing it, you are just checking if it exists by treating it as an object. For it to be executed you have to include the brackets then you would be dealing with what it returns.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:
- “They say hard work never hurt anybody, but I figure, why take the chance.”
-
jduartedj
- Posts: 599
- Joined: Sat Dec 19, 2009 12:18 am
- Location: Lisbon
-
Contact:
#3
Post
by jduartedj » Wed Jan 19, 2011 6:27 pm
will further test it!
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests