Codea possible spriteSize bug

I have recently purchased Codea and have been learning off of forums and Youtube tutorials. However, after watching Patrick Coxall’s fourth video, I have encountered a huge problem. I’m not sure if I’m using the spriteSize function correctly. Every time that I try to find the size of a sprite using the spriteSize function, the app just doesn’t respond to what I am doing. I tried printing the spriteSize and the image, and the output was “0 0”. I am really confused and I have tried so many different things to get it to work. Has anyone else encountered this problem? Is it just a bug? How exactly do you use the spriteSize function??

Here is the code that i used:
imageName = (“SpaceCute:Beetle Ship”)
imageSize = vec2(spriteSize(imageName))
print(imageSize.x, imageSize.y )
my output:
0.0 0.0

The spriteSize function is not returning the size of my image (which is called imageName).
From my understanding, spriteSize should return the pixel size of an image. Why is this code not working?
any help would be greatly appreciated.

You should post your code, then we can see the problem

Personally, I don’t use spriteSize. I just use the width and height properties.

Here’s an example of spriteSize.

function setup()
end

function draw()
    background(40, 40, 50)
    fill(255)
    sprite("Planet Cute:Character Boy",WIDTH/2,HEIGHT/2)
    w,h=spriteSize("Planet Cute:Character Boy")
    text("sprite size  "..w.."  "..h,WIDTH/2,HEIGHT-100)
end

Here is how to use the spriteSize function:

local width,height = spriteSize("Planet Cute:Character Boy")

print(width,height)

Also, usually it’s your code that’s causing the problem, not Codea. Please post your code whenever you find a “bug” so that we can decide wether it is codea’s fault or not. :slight_smile:

Woops, I’m sorry @ignatz and @dave. You wrote your comments at the same time as me, so I’m sorry that I wrote something very similar to yours :#

@Kolosso That happens to me a lot. I usually do a save draft and then check to see if someone already made a comment similar to mine before I hit the post comment button.

“What am I doing wrong?” is a healthy first instinct to have in coding, rather than, “my tools must be at fault”. Codea is quite a mature platform now (in iOS terms), so other than some minor known issues, it’s stable.

@Ignatz, @Kolosso, @dave1707, thank you all for your help and advice, it turns out I had my code under the wrong function. I got it to work! :smiley: thanks again!!

@yojimbo2000 “what am I doing wrong” WAS my first instinct, which is why i spent over four hours going over the code to find my mistake. I even rewrote it in a new project, but everything was written exactly how i saw it in the video i was watching, and it worked perfectly fine in the video! Obviously after so many attempts and so much time spent trying to fix one problem its natural to eventually resort to the conclusion that it could be a bug, which is why i was only asking if any one else had the same problem as i did…