How can I call a callback function in xtend?
I am looking for something similar to the one in C. Example:
struct callbacks
{
char name[10];
boolean (*pfState)();
};
static const struct callbacks call[] = {
{"YOURS", &isOwner},
{"OURS", &our_owner}
};
So, I will just call it like this: call[0].pfState()
.
I have created a similar ArrayList in xtend.
val you = new youModule()
val our = new ourModule()
val callbacks = newArrayList('YOURS' -> you.isOwner, 'OURS' -> our.isOwnder);
Am I doing this correctly? How can I execute the function call in the pair?