• 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] Need help with Zinc

Status
Not open for further replies.
1. Using zinc, I have not been able to figure out how to implement a readonly struct member. Is there a way I can turn off the zinc check from within the struct to do this, or some other workaround?

2. Do I really have to put "this" as a prefix before every "." ? Or am I encountering this weirdness because of some other error I've made?

3. I should note that I'm doing this using the //! zinc & //! endzinc tags.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
JASS:
    struct output {
        private string msg;
        
        method doWhat() {
            BJDebugMsg(msg);
        }
        
        static method create(string msg) -> thistype {
            thistype dat=allocate();
            dat.msg=msg;
            dat.doWhat();
            
            return(dat);
        }
    }

This compiled correctly for me, so I'm certain that the struct members are referenced the exact same way. I just skimmed through the zinc manual, haha, looks pretty interesting.

This is the full script:

JASS:
//! zinc
library HelloWorld {
    
    struct output {
        private string msg;
        
        method doWhat() {
            BJDebugMsg(msg);
        }
        
        static method create(string msg) -> thistype {
            thistype dat=allocate();
            dat.msg=msg;
            dat.doWhat();
            
            return(dat);
        }
    }
    
}
//! endzinc
 
Status
Not open for further replies.
Top