• 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.

[Solved] Static If Question

Status
Not open for further replies.
Level 17
Joined
Feb 11, 2011
Messages
1,860
Hello,

I want to make a library which optionally requires T32.
How can I use static ifs to do this?
I have this so far:

JASS:
static if (LIBRARY_T32) then

private method periodic takes nothing returns nothing
    // ...
endmethod

implement T32x

endif
But this gives an error, saying that the module was not found (when I disable T32).
Is there a way to get around this, or can T32 not be made optional?

Thanks,

Mr_Bean
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
You can just try checking if a specific method exists like

static if T32.init.exists{

}

(jass+java lol)
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
Thanks for the replies guys.

Anachron said:
Hi Mr_Bean, I found this (ancient) post which is about the same question.
For a better understanding, from the Vexorian vJASS manual. (Search for static ifs)
Hope this helps.

I understand static ifs, I am just having trouble with putting implement T32x in a static if.

Maker said:
What version of CTL are you using? There is no T32x module in the system in jass forum.

I am using Timer32 version 1.06.

Maker said:
I have had success using static if to wrap a whole function. Not sure why it doesn't work for you. Try removing the brackets, though that most likely isn't the issue.

Wrapping the function works, it throws an error with the implement T32x line, saying that the module wasn't found (when T32 is disabled).

Arhowk said:
You can just try checking if a specific method exists like

static if T32.init.exists{

}

(jass+java lol)

Thanks, will give it a try. Is that in zinc or something?

Ender said:
does your library require optional t32?

Yes.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Thanks for the replies guys.



I understand static ifs, I am just having trouble with putting implement T32x in a static if.



I am using Timer32 version 1.06.



Wrapping the function works, it throws an error with the implement T32x line, saying that the module wasn't found (when T32 is disabled).



Thanks, will give it a try. Is that in zinc or something?



Yes.

no ive been programmnig in java since i quit wc3 -_-
 
Status
Not open for further replies.
Top