Chaosy
Tutorial Reviewer
- Joined
- Jun 9, 2011
- Messages
- 13,239
I've been trying to implement a interface to my code.
The idea is to make the system call a function of choice at one point in time.
You can use
Or maybe it does (library.function does not work though), but Zinc does not have the .typeid for some reason and I did not find any info in the Zinc manual either.
At the moment I've tested
edit: I think it'll work if the function is inside a struct.. I will try that in the meantime.
edit: Solved
Omfg, it was so simple. I simply had to use a variable of the interface.
The idea is to make the system call a function of choice at one point in time.
You can use
integer test = Library.typeid
and then I thought call test.Function()
would work.Or maybe it does (library.function does not work though), but Zinc does not have the .typeid for some reason and I did not find any info in the Zinc manual either.
At the moment I've tested
Library__Function
, which works, but I can't store it into a variable which makes it useless for me.edit: I think it'll work if the function is inside a struct.. I will try that in the meantime.
edit: Solved
Omfg, it was so simple. I simply had to use a variable of the interface.
JASS:
type craftFunc extends function(unit);
craftFunc callback = test.onCraft;
CraftInterface(u, callback);
function CraftInterface(unit u, craftFunc c)
{
c.evaluate(u);
}
Last edited: