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

[JASS] public memebers of a struct

Status
Not open for further replies.
Level 13
Joined
Nov 22, 2006
Messages
1,260
I've been looking through some systems, for example xe, and I noticed that all the accessible members are public. Isn't that supposed to add the library name as the prefix? Then why am I able to access it by a simple structname.var syntax?
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
public / private is all about the scope of variables. A struct definition lies within the scope of a library, hence why a public struct needs to be accessed by using Library_struct. The members of a struct lie within the scope of a struct, hence why a public member doesn't have anything to do with libraries but has everything to do with the struct itself.

Besides, how would you see it work?
JASS:
library B
struct A
    public integer i
endstruct
endlibrary

local A a = A.create()
set a.B_A_i = 0 // the fk?
 
Status
Not open for further replies.
Top