0 votes

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?

in Engine by (46 points)
edited by

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.

1 Answer

0 votes

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.

by (1,945 points)
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.
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 webmaster@godotengine.org with your username.