What are empty files?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JulioYagami

I’m working on a project that have a ‘empty class’ with two vars only. I didn’t understand what is it for and if it could be used.

Here is the class:

# only confirmed and finished translations here - they will be use on build
var available = ['en', 'de', 'es', 'fr', 'ja', 'pl', 'ru']

# languages available locally - ADD OWN LANG HERE
var in_develop = ['pt']

It doesn’t contains a extends Node so it isn’t a singleton. Is it a storage class? How do I could use that?

:bust_in_silhouette: Reply From: Zylann

It is a regular class which inherits Reference (it’s the default if you don’t specify extends) and has two member variables.

You can use it like this:

const Store = preload("store.gd")

func _ready():
	var storage = Store.new()

Given how it looks, if the intention was to store some config vars that are not meant to be a modifiable object, those vars could be changed to const and then can be read without new:

const Store = preload("store.gd")

func _ready():