• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJASS] interface issue

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 41
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 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:
Status
Not open for further replies.
Top