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

[vJASS] Tell me more, About different Between Scope and Struct, Plz

Status
Not open for further replies.
Level 5
Joined
Jan 4, 2009
Messages
118
Tell me more, About different Between Scope and library Plz

I want to know how to use both statement. Sometime I ever see use struct for new trigger. It can be? And Scope When I use it?
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
A scope is a block of code which can have private and public members. Public members can be seen from anywhere in your code (well, anywhere below that scope) but must have the scope's name prefixed. Private members cannot be seen from outside the scope.

A scope can also have an initializer, which is a function called upon map initialization.

Structs are related to Object Oriented Programming and have more features than I care to list.

Both scopes and structs are documented in the vJass manual.
 
To answer your question more directly, vJass has included features to allow structs to have initializers, and some java programmers who use vJass prefer to handle all their triggers in structs.

That being said, this doesn't mean you should use structs to handle your triggers. Most vJass gurus will recommend scopes.

In PurplePoots link, I'd recommend starting here: http://www.wc3c.net/vexorian/jasshelpermanual.html#lib

Start with globals, libraries, and scopes, and much much later you can start reading about structs.

Good luck,
 
Status
Not open for further replies.
Top