|
|
#1 |
|
Junior Member
Join Date: May 2011
Posts: 11
|
Can I call functions dynamically?
I have some strings stored in variables. For example, let $0 = "Foo" and $1 = "Bar". I have two functions that have to be called - MyFuncFoo and MyFuncBar. I have to call these functions by enumerating variables - something like Call "MyFunc$0" and then Call "MyFunc$1". I need such behavior because order of variable's values may vary, and some values may be skipped, so order of function calls will vary too. I know it's not possible to specify function name as string in Call, but may be I can emulate this behavior somehow? or any other way to do that?
|
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,775
|
GetFunctionAddress (You can also call labels)
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: May 2011
Posts: 11
|
But how can it help if parameter for GetFunctionAddress must be static compile-time string not containing any variables?
|
|
|
|
|
|
#4 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,775
|
The other alternative is a function with just a big switch and it would have to know all the names of the functions...
IntOp $PostCount $PostCount + 1 |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|