dreadkhan Posted April 23, 2009 Share Posted April 23, 2009 I need a hand in implementing dynamic function calls.I would like to keep an array of strings, that map to function names like...global $myarray[3]$myarray[0] = "function1"$myarray[1] = "function2"$myarray[2] = "function3"this is for an irc bot, where i would have a help command return this array of available commands. then when you send a command, have it call that function.so when someone in irc says.. function1it would iterate throguh the available strings in this array, realize that function1 exists and attempt to invoke a function called...function1.so basically, given a string that represents the name of a function, how can i invoke that function?I also need to have the ability to check if the function exists, is a try catch that best way to accomplish that? Link to comment Share on other sites More sharing options...
monoceres Posted April 23, 2009 Share Posted April 23, 2009 Call(), check the help file. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
dreadkhan Posted April 23, 2009 Author Share Posted April 23, 2009 Call(), check the help file.thats incredibly useful, thank you.how can i check if a function exists before using Call()? Link to comment Share on other sites More sharing options...
monoceres Posted April 23, 2009 Share Posted April 23, 2009 thats incredibly useful, thank you.how can i check if a function exists before using Call()?if the function doesn't exists @error will be set to 0xDEAD. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 23, 2009 Share Posted April 23, 2009 That error code is win. Link to comment Share on other sites More sharing options...
monoceres Posted April 23, 2009 Share Posted April 23, 2009 That error code is win.MsgBox(Call(Eval("")),"Win!",Hex(@error*65536+@extended,8)) Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 23, 2009 Share Posted April 23, 2009 I feel sorry for you and your wasted free time. Link to comment Share on other sites More sharing options...
monoceres Posted April 23, 2009 Share Posted April 23, 2009 I feel sorry for you and your wasted free time.I wouldn't call staying up at 2 am when you should be sleeping free time. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 23, 2009 Share Posted April 23, 2009 (edited) lol that is an awesome error message.. even when you don't WANT to see one... lolSets @error to 0xDEAD and @extended to 0xBEEF if the function does not exist or invalid number of parameters.0xBEEF... WTF hahahaha SWEET i never noticed that beforeandI wouldn't call staying up at 2 am when you should be sleeping free time.wow man.... all i have to say... Edited April 23, 2009 by CodyBarrett [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now