self[i] in class in godot 3.1

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

Previously, I could use this piece is a custom class

func update():
    for i in array:
	    self[i] += 0

But after moving to 3.1 alpha, self[i] does not seem to be allowed in any form when its inside of custom class, giving “Can’t index on a value of type ‘’” error. What’s the replacement for it now?

Yeah same, I was using self[name] = something for modifying members without problem on my last year project and today I try to work again on it and I got error on this self line.

Maxime | 2019-05-13 23:21

:bust_in_silhouette: Reply From: Akien

You can use set and get instead:

for i in array:
    set(i, get(i) + 0)

But that might be worth a bug report nevertheless to check if this was an intentional compatibility breakage or not.