Quote:
Read the post! "lolz" shall be a void* 
Then cast it to a function pointer, then call it.
Yeah I managed to get it working now. But thats so ugly! I mean that you have to declare a function pointer outside the struct (like if the one within it wasnt enough), and then cast from the struct to the pointer, and then call it. Is there really not any other solution?
Btw thought it might be a good idea to post solution so that others can see...
SOLUTION
Code:
#include <acknex.h>
#include <default.c>
#define new(TYPE) malloc(sizeof(TYPE))
#define delete(OBJECT) free(OBJECT)
typedef struct
{
int id;
var coolness;
STRING* name;
void* lolz;
} ITEM;
ITEM* obj1;
ITEM* obj2;
function init_item(ITEM* item, var coolness, STRING* name)
{
static int count = -1;
item.id = ++count;
item.coolness = coolness;
item.name = name;
}
TEXT* pnl =
{
pos_x = 10;
pos_y = 10;
flags = VISIBLE;
}
function fp();
function test()
{
(pnl.pstring)[0] = obj1.name;
}
function perform()
{
fp = obj1.lolz;
fp();
}
function main()
{
screen_color.blue = 155;
obj1 = new(ITEM);
init_item(obj1, 2, "Hej");
(pnl.pstring)[0] = "woot";
obj1.lolz = test;
on_a = perform;
}