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

[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