Library "Requires"

Tyrulan

Ultra Cool Member
Reaction score
37
When is it needed to add requires to your library?

I'm using it just to keep track of which libraries I'm referencing, but if I were to remove the "requires" labels it would still compile properly.
 

Nherwyziant

Be better than you were yesterday :D
Reaction score
96
If a function inside library B needed to call a function inside library A we should let JassHelper know that A must be added before B. That's the reason the 'requires' keyword exists:

JASS:
    library B requires A

        function Bfun takes nothing returns nothing
           call Afun()
        endfunction

    endlibrary

    library A

        function Afun takes nothing returns nothing
        endfunction

    endlibrary
 

Tyrulan

Ultra Cool Member
Reaction score
37
That is strange to me, since my library has call to many other libraries for various tasks and don't need a "requires" header.
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
How the compiler orders libraries is partially arbitrary, so you could wind up being lucky and not having to put the requires keyword. Best to do it anyway though.
 

SanKakU

Member
Reaction score
21
without seeing your libraries in full it would be hard to tell if you are even doing anything that would make a library require another, anyway.
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Great, CK, you're making up your own funny terms ._.
That's why he's confused xD

And you CAN use it..
If you don't use a library or you get really lucky and Damage is put really up high. =x
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Like, you cant use Damage( By J4L ) without requires.
Cause that cathes up all functions from the System.

:nuts:
bunny-pancake.gif
 

tooltiperror

Super Moderator
Reaction score
231
In other news, the awesome thing about libraries is you used to be able to make them require each other to bug JassHelper.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top