What does [[Reference:1261]] mean?

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

Hy everyone,

I have a code that needs to retrieve an array containing arrays. When I test, it gives me [[Reference:1261]]. but it doesn’t indicate any error. The code is meant to make an edge-based astar to block certain directions. I use a tilemap

A class to hold information :

class Wall:

var Direction : Vector2
var Diagonals : Array

func _init(dir : Vector2, diago:Array):
	Direction = dir
	Diagonals = diago

I make a list of directions, which I combine :

const DIRECTION = {
"N" :Vector2(0,1),
"S" :Vector2(0,-1),
"E" :Vector2(0,1), etc...

onready var WALL = {
"N" : Wall.new( DIRECTION["N"], [DIRECTION["N_E"], DIRECTION["N_O"]]),
"S" : Wall.new( DIRECTION["S"], [DIRECTION["S_E"], DIRECTION["S_O"]]), etc...

onready var WALLS_ON_EDGES = {
TYPE_WALLS.CORNER_N_O : [WALL["N"], WALL["O"]],
TYPE_WALLS.CORNER_N_E : [WALL["N"], WALL["E"]], etc...

enum TYPE_WALLS {CORNER_N_O, CORNER_N_E, CORNER_S_O, CORNER_S_E,
		WALL_N, WALL_E, WALL_S, WALL_O,
		NO_PASS, FREE_PASS
		}

At each tilemap index, I give it the array contained in WALLS_ ON_ EDGES

func Add_connect_type(n:int, type_walls:int):

 ///... code
	
if WALLS_ON_EDGES.has(type_walls):	
	_cells_index_with_wall[n] = WALLS_ON_EDGES[type_walls]

Then, I select the index of a particular tile and store the array of that tile to do operations with :

func Create_all_Walls_on_edges():
var all_index_with_wall = _cells_index_with_wall.keys()

///... code

for idx in all_index_with_wall:

	#array of all cells with idx
	var cells_idx = get_used_cells_by_id (idx)

	#Walls of idx
	var ar_walls_of_idx = _cells_index_with_wall[idx]

	print("ar_walls_of_idx : " + str(ar_walls_of_idx))
	if ///...code

the ar_ walls _of _idx indicates: [[Reference:1261]]

Do you know how to interpret it?
Good Day,

Arrays are passed via references. All variables made equal to certain array will behave like hyperlinks to just one array value. Still, that doesn’t explain why printing returns this reference instead of value. Did You try it without str()? Or could it be that original array was freed before print() line ?

Inces | 2022-05-18 19:53

Hello,
Thank you for the answer.

“Did You try it without str()? Or could it be that original array was freed before print() line ?”
The array is used as a reference so once initialized, I don’t touch it anymore. I tried without the str() by putting directly the value → print(ar_walls_of_idx), but it tells me the same thing.

On the other hand, I managed to access the values they contain.

patatra | 2022-05-19 05:12