• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[vJASS] interface issue

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,184
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