Originally Posted By: Gamestudio Manual
Function pointers
Pointers of functions or actions can be defined as FUNCTION* under C-Script. LC Under lite-C a function pointer is defined just as a function prototype with return and parameter types. Example:
Code:
float myfunction(int a, float b); // define a function pointer named "myfunction"  

float fTest(int a, float b) { return (a*b); }
...
myfunction = fTest;
x = myfunction(y,z);


For storing arrays of function pointers in lite-C, void* arrays can be used. Example:
Code:
float myfunction(int a, float b); // define a function pointer

void* function_array[100];        // define a pointer array

float fTest(int a, float b) { return (a*b); }
...
function_array[n] = fTest;
myfunction = function_array[n];
x = myfunction(y,z);



Last edited by Aku_Aku; 10/20/13 17:09.