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

Encapsulation question about vJass.

Status
Not open for further replies.
Level 23
Joined
Feb 6, 2014
Messages
2,466
Scenario: I have a library that has structs in it but I want to use that struct in a global block and be private (limited to the library) at the same time, example:
JASS:
library A
    globals
        B something
    endglobals
  
    private struct B
    endstruct
  
endlibrary
^The does not compile because it shouldn't be private struct.
Is it possible? I assume Vexorian made it possible.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,184
I tried a few things myself, none worked.
This was one thing I tried but it did not work, sadly.
JASS:
library A
    private struct B
		public static B something
    endstruct
endlibrary

library X
	function onInit takes nothing returns nothing
		set something = 1
	endfunction
endlibrary

The only thing I can come up with would be to do it the other way around. Basically making the struct public, but making every method/variable private.
 
Status
Not open for further replies.
Top