|
FunctionIndex | ||
Index = FunctionIndex(FunctionName$) | ||
Parameters: FunctionName$ = Name of the function |
||
Returns: Index = The Index of this function |
||
The FunctionIndex function allows us calculate a functions internal index. We can then use this to call the function with the CallFunction command. The benefit of pre-calculating the functions index, rather than calling it by name all the time. Is that this bypasses the need for the CallFunction operation to constantly resolve the functions index from the name we provide it. Now If you're only calling a function a few times, then it probably doesn't matter too much, but if you're going to be calling it a lot, then this overhead really adds up. FACTS:
Mini Tutorial #1: This example sets up an array that will contain our list of function indexes. Within this array, we're storing the FunctionIndex function of each function we wish to call. Then at run time, we can pass these indexes to CallFunction to execute the function on demand.
Mini Tutorial #2: This example compares how long it takes to call a function by name or by index using CallFunction
|
Related Info: | CallFunction | Function | FunctionExist | Functions&Psub | Psub : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |