k
kept

In this line of code: export(Array, Resource) var items := [] setget set_items

Is "Array" the variable's type and "Resource" what it ''accepts'' in the array?

Also I assume the order matters right? 

1 love
  • Razoric replied

    Correct. You are exporting an "Array" of "Resource"s

    1 love
  • Nathan Lovato replied

    To add to my teammate's answer, the part in parentheses is a bit special, it's a syntax to give extra information to the Godot editor. The type of the variable items is Array. GDScript, in Godot 3, doesn't have a way for us to set a variable's type to "an Array that only contains Resource instances." But after the export keyword, in parentheses, we can give the Godot editor extra information. You got it right, we're telling it "the items variable is an Array, and when using the Inspector, I only want to be able to drag and drop Resource instances/files onto the slots"

    1 love