var PlayersMap: [player]CustomPlayerData = map{}
How would I access this in a separate class?
This example is assuming one file, and is very simple.
player_tracker := class():
var PlayersMap: [player]custom_player = map{}
another_class := class():
PlayerTracker:player_tracker =player_tracker {}
OnStart():void=
PlayersMap := PlayerTracker.PlayersMap
You will need to take into account for the Access Specifiers of the member you are trying to access in another class. This can get more complicated with multiple files and modules.
This documentation will help:
A simple example is adding the private specifier here means that you cannot use PlayersMap outside of player_tracker.
player_tracker := class():
# cannot be accessed outside of this class
var<private> PlayersMap: [player]custom_player = map{}
After you get this working, to continue to improve your knowledge and skills I would consider thinking about making this map private, and instead you should expose public functions that can be used instead.
Ask yourself what are the common ways another class is using the PlayerMap, is it just to ask if a player exists, and to get the custom_player class instance? You can make those public functions.
Maybe adding/removing a player should only be done within this class, or maybe you want that to be public functions for another system to control.
It will evolve over time, and you want to encapsulate logic to be easily re-used, and hidden from things that shouldn’t need to know. That way you can change how things work later without affecting other systems that use it.