godot icon indicating copy to clipboard operation
godot copied to clipboard

GDScript 2.0: String" and "" for "in" operator

Open Shadowblitz16 opened this issue 1 year ago • 1 comments

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

Test.zip

Shadowblitz16 avatar Aug 06 '22 23:08 Shadowblitz16

Seems very similar to #51538

KoBeWi avatar Aug 07 '22 01:08 KoBeWi

I cannot reproduce. There has been many changes since the report, so I'll assume it was fixed along the way.

vnen avatar Feb 22 '23 14:02 vnen