Define Jagged Array

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

Any idea how to define a Jagged array ? (or list of list )
Along with some initialization values ?


You could possibly use a dictionary of arrays.

Magso | 2019-05-05 16:46

Thx for ur reply but I am looking to have the below 3 “g” arrays inside one array for easier access:

refArr1 = [1,2,3]
refArr2 = [6,8,3]
refArr3 = [9,9,0]
refArr4 = [4,5,6]

onready var gPLArray = [refArr1, refArr2,refArr3,refArr4]
onready var gPLRep = [8,1,8, INF]
onready var gPLH = [0,4,6,-7]

Maybe an array of some struct / class is better in this case…

GameVisitor | 2019-05-05 17:33

Isn’t that what Dictionaries are?

From documantation:
Dictionary type. Associative container which contains values referenced by unique keys. Dictionaries are always passed by reference.

Dictionary — Godot Engine (latest) documentation in English

Ole | 2019-05-06 04:36