0 votes

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

Thanks.

asked May 5, 2019 in Engine by GameVisitor (834 points)
edited May 5, 2019 by GameVisitor

You could possibly use a dictionary of arrays.

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...

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.

https://docs.godotengine.org/en/latest/classes/class_dictionary.html

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.