Imagetable Error Animated Sprite Library

Hey Everybody,

I'm new to the forum and just getting started with the SDK. I'm following along with one of Squidgod's videos and I'm receiving an error that's tracing back to the Animated Sprite Library. The specific error is preventing me from running what I've coded so far in the simulator.

The error says: "attempt to get length of a number value (field 'imagetable')"

and the stack traceback goes back the AnimatedSprite.Lua file on the line that has "framesCount = #self.imagetable,"

Any ideas on what's wrong? My image table is named correctly and I've been following Squid's code exactly. Any help is appreciated!

Is the image at the correct location in your project files?

Load will not complain if it can't find the image. So using:


will stop your code if the image you are checking has not loaded correctly.

Thank you for the tip. Yeah it looks like the image is in the right place, but I'm still getting the error. Have tried changing various things but no luck.

Are you referring to this line? It looks like the AnimatedSprite:init method accepts an imagetable argument. What are you passing into the constructor?

did you try assert()?

I did- it didn’t return any errors associated with the assert line.

I’m passing the imagetable that I have linked to the player in an images folder and formatted in the player-image-16-16.png format. Thank y’all for responding to this thread! Sorry for my ignorance with terminology that would probably make my answers more helpful.

Sorry all- got it figured out. Beginner’s mistake on my part with not being consistent on upper and lower case. Really appreciate the responses though and I learned something in the process.

1 Like

Glad you got it figured out!