godot-python icon indicating copy to clipboard operation
godot-python copied to clipboard

Can't export array from global autoload python script

Open pr0mixe opened this issue 7 years ago • 1 comments

Hi, TouilleMan, I'm trying to use Godot's Array class from python. I have a global.py script (excerpt):

@exposed
class Global(Node):
	key_signal = signal()
	test = export(str)
	velocities = export(Array)
	
	def _ready(self):
		self.test = 'ttttt'
		self.velocities = []

The self.velocities array is working properly WITHIN global.py, but when I try to access it from another GDscript the error message is issued: "Invalid get index 'velocities' (on base: 'Node (global.py)'). Accessing 'Global.test' variable from other GDscripts is working fine.

If I change velocities = export(Array) to velocities = export(array) instead the whole engine crashes. Please point me in the right direction to access 'velocities[]' variable from other GDscripts. Thank you!

pr0mixe avatar Sep 16 '18 05:09 pr0mixe

It is working now by changing the last line in the above code snippet to: self.velocities = Array() instead of: self.velocities = [] Thanks!

pr0mixe avatar Sep 16 '18 20:09 pr0mixe