Jump to content

Recommended Posts

Posted

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.. function1

it 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?

Posted

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!

Posted

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!

Posted (edited)

lol that is an awesome error message.. even when you don't WANT to see one... lol

Sets @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 before

and

I wouldn't call staying up at 2 am when you should be sleeping free time.

wow man.... all i have to say...

Edited by CodyBarrett

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...