godot
godot copied to clipboard
GDScript 2.0: String" and "" for "in" operator
Godot version
4.0 alpha 12
System information
KDE neon 5.25
Issue description
Autoloads don't work directly with the in operator when checking for if a variable exists. You have to set it to a variable first...
https://cdn.discordapp.com/attachments/908062856459743262/1005618717356466287/unknown.png https://cdn.discordapp.com/attachments/908062856459743262/1005619270690013224/unknown.png
Steps to reproduce
- Have code that tried to check if something is in a Autoload like this..
if "myVaribable" + str(1) in MyAutoload):
- See it doesn't work
- Fix it by storing the autoload into a variable first...
var myAutoload = MyAutoload
if "myVaribable" + str(1) in myAutoload):
Minimal reproduction project
Seems very similar to #51538
I cannot reproduce. There has been many changes since the report, so I'll assume it was fixed along the way.