Code:
// some function
void doSomething(void)
{
   draw_text("Doing something",20,20,vector(255,255,255));
}

// some struct
typedef struct someStruct
{
   void* myFunction;

}someStruct;

someStruct* myStruct = 
{
  myFunction = doSomething;
}

void prototype_doSomething(void);
// a main void
void main()
{
   while(1)
   {
      if(key_j)
         prototype_doSomething = myStruct.myFunction;
         prototype_doSomething();
      wait(1);   
    }
}



This should work. You can't call functions from structures. Structures are not classes, they are data collections. Lite-C only allows function pointers in structures. So you have to define a prototype function without body, assign the pointer from the structure to the prototype, and then call the prototype instead.


Click and join the 3dgs irc community!
Room: #3dgs