Fossil Rock Posted January 13, 2006 Posted January 13, 2006 (edited) Is it possible to make an array that sends to the proper function? Right now I have them all in if statements. Something like this... $Array[2] = "Option_4"; will have 10 - 20 options $Func = "_" & $Array[2] & "()" $Func ; This should = _Option_4() Func _Option_1() Does something EndFunc Func _Option_2() Does something EndFunc Func _Option_3() Does something EndFunc Func _Option_4() <------ goes here Does something EndFunc Func _Option_5() Does something EndFunc Func _Option_6() Does something EndFunc Edited January 16, 2006 by Fossil Rock Agreement is not necessary - thinking for one's self is!
blademonkey Posted January 13, 2006 Posted January 13, 2006 Is it possible to make an array that sends to the proper function? Right now I have them all in if statements. Something like this... $Array[2] = "Option_4"; will have 10 - 20 options $Func = "_" & $Array[2] $Func() ; This should = _Option_4() Func _Option_1() Does something EndFunc Func _Option_2() Does something EndFunc Func _Option_3() Does something EndFunc Func _Option_4() <------ goes here Does something EndFunc Func _Option_5() Does something EndFunc Func _Option_6() Does something EndFuncI'm actually trying to find out how to do the same thing but with arrays. ---"Educate the Mind, Make Savage the Body" -Mao Tse Tung
Fossil Rock Posted January 17, 2006 Author Posted January 17, 2006 (edited) I figured it out!! WoohoooLet me put a brief description up so you'll understand how I came to make this work.1) I read a line of text in using the splitstring function ; which is used in an array ($Array[])2) the second variable ($Array[1]) is what I check for ( there are 14 different possible values )3) it returns 'Option 1' 4) I create a variable like so ... $Func = "_" & $Array[2] ------> which equals "_Option 1" ; without the qoutes5) Then I just activate it with the 'Call' fuction -------> Like so ... "Call ($Func)" ; again without the quotesNOTE: You must have a Func with the value in $Func for it to work.BAM!!! works perfectly for me. Edited January 17, 2006 by Fossil Rock Agreement is not necessary - thinking for one's self is!
blademonkey Posted January 17, 2006 Posted January 17, 2006 (edited) I figured it out!! Woohooo Let me put a brief description up so you'll understand how I came to make this work. 1) I read a line of text in using the splitstring function ; which is used in an array ($Array[]) 2) the second variable ($Array[1]) is what I check for ( there are 14 different possible values ) 3) it returns 'Option 1' 4) I create a variable like so ... $Func = "_" & $Array[2] ------> which equals "_Option 1" ; without the qoutes 5) Then I just activate it with the 'Call' fuction -------> Like so ... "Call ($Func)" ; again without the quotes NOTE: You must have a Func with the value in $Func for it to work. BAM!!! works perfectly for me.Ok I got it. Thanks. Edited January 17, 2006 by blademonkey ---"Educate the Mind, Make Savage the Body" -Mao Tse Tung
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