0 votes

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


in Engine by (853 points)
edited by

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.


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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.