Skip to content
Franco Montenegro edited this page Apr 17, 2016 · 4 revisions

Libraries

Libraries work the same as vJASS. The only thing to remember though, is that the requires defines the execution of the initialization code.

So for example

library foo requires bar
    function onInit takes nothing returns nothing
    endfunction
endlibrary

library bar
    function onInit takes nothing returns nothing
    endfunction
endlibrary

The onInit of bar is going to be executed first, and then foo.

Visibility

By default, all members of a library are private. The same goes for global variables.

Initializer

If there is a function called onInit it will automatically get called at map initialization.

library foo // no need for 'initializer onInit'
    function onInit
        call BJDebugMsg("Nice!")
    endfunction
endlibrary

Namespaces

library foo
    public function bar ...
    endfunction

    public struct baz
        public static method someMethod ...
        endmethod
    endstruct
endlibrary

call foo.bar()
call foo.baz.someMethod()

You have to use "." (dot) in vrJASS instead of "_" (underscore).

Clone this wiki locally