Hi!
I'm trying to make a table containing bitmaps and then set the position of the bitmaps.
But I'm getting the error:
main.lua:8: bad argument #1 to 'setPosition' (Sprite expected, got number)
stack traceback:
	main.lua:8: in function 'init'
	[string "property.lua"]:52: in function '__new'
	[string "property.lua"]:59: in function 'new'
	main.lua:17: in main chunk
This is the code:
scene = Core.class(Sprite)
function scene:init()
	local blueCube = Bitmap.new(Texture.new("images/blueCube.png", true))
	
	stackOne = {[1] = blueCube, [2] = blueCube, [3] = blueCube}
	
	stackOne[1].setPosition(100, 100)
	stackOne[2].setPosition(100, stackOne[1].getHeight() + 100)
	stackOne[3].setPosition(100, stackOne[2].getHeight() + 100)
	
	for key in stackOne do
		self: addChild(key)
	end
end
sc = scene.new()
stage: addChild(sc)
                
                
             
        
Comments
stackOne[1]:setPosition(100, 100)
Note the colon before setPosition. this causes stackOne[1] to be passed in as the first argument to setPosition.
https://github.com/gideros/gideros
https://www.youtube.com/c/JohnBlackburn1975
When I started a few months back, it was the most likely cause for an error for a few days.
Thanks for the replies.