• 🏆 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!

What the hell are these things ?

Status
Not open for further replies.
Level 15
Joined
Oct 29, 2012
Messages
1,474
Hi
I am an JASS amateur. you can say I just understand the syntax

In many spells and systems, I find requirements be :
- Units Indexer ...
- Libraries ...

And some other things lel.

I've read their descriptions, I still don't know their usefulness

Anyone who gives a brief definition for them is kewjl lel, I mean I will appreciate his help :D
 
Functions in jass have only access to functions that are placed above after compilation.

JASS:
function A takes nothing returns nothing
    call B()    //won't work
endfunction

function B takes nothing returns nothing
    call A()    // works
endfunction

So if you make a system that should work for all functions you must ensure that it gets above them all. How? --> library (library is a vJass feature, not jass)


JASS:
library Test

    function A takes nothing returns nothing
    endfunction

endlibrary
Now all functions have access to function A.

So a library is just a collection of code that is useable by all non-library code, because library compiled code is placed above.

But in case library A needs access to functions from library B, you have to use the requires keyword to ensure correct compilation:
JASS:
library A requires B

    function a takes nothing returns nothing
        call b()
    endfunction

endlibrary
JASS:
library B

    function b takes nothing returns nothing
    endfunction

endlibrary

UnitIndexer is just an example for a useful library. It gives an unit specific index for each existing unit, so you can directly work with it.
And that's the sense of libraries. They should include useful code that just gets imported and then can be used easily. We don't want to create each system from scratch for each new project so we import libraries to make life more simple.

You can read more:
http://www.hiveworkshop.com/forums/tutorial-submission-283/simple-jass-tutorial-beginners-251698/
http://www.wc3c.net/vexorian/jasshelpermanual.html#lib
 
Status
Not open for further replies.
Top