How to know the installed user functions?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
jduartedj
Posts: 599
Joined: Sat Dec 19, 2009 12:18 am
Location: Lisbon
Contact:

How to know the installed user functions?

#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?
Thanks for reading! :D

Some of you might find this useful: RoM-bot Wiki
User Functions Repository (and other useful files): Addon Repo
Latest SVN updates: SVN updates

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: How to know the installed user functions?

#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.”
          • Ronald Reagan

User avatar
jduartedj
Posts: 599
Joined: Sat Dec 19, 2009 12:18 am
Location: Lisbon
Contact:

Re: How to know the installed user functions?

#3 Post by jduartedj » Wed Jan 19, 2011 6:27 pm

will further test it!
Thanks for reading! :D

Some of you might find this useful: RoM-bot Wiki
User Functions Repository (and other useful files): Addon Repo
Latest SVN updates: SVN updates

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests