sprite:getScale() documentation is wrong?

either the docs are wrong, or I am misreading this -

playdate.graphics.sprite:getScale()
Returns multiple values (xScale, yScale) , the current scaling of the sprite.

when I call this, it just returns a single number - 1.0

I thought maybe it just returns a single number if the scale of x and y are uniform, but that doesn't seem to be the case either.

for example this -

self.gateLattice:setScale(0.5, 0.7)
local latticeScaleCurrent = self.gateLattice:getScale()

latticeScaleCurrent is number - 0.5!

what am I missing here? wondering if it's just a lua syntax thing I'm messing up, or if there's actually a bug in the sdk here

It returns multiple values so you need to assign multiple variables. It's a Lua thing.

self.gateLattice:setScale(0.5, 0.7)
local latticeScaleCurrentX, latticeScaleCurrentY = self.gateLattice:getScale()

Discussion https://devforum.play.date/t/how-do-i-get-accelerometer-x-y-z-values-compiler-says-its-a-single-number/469/6

2 Likes

ok this makes sense, thanks for clarifying! There was no way getScale was going have a bug in it :slight_smile: