Need a hand with Sprites being passed to Classes

I’m having issues passing a sprite into a class. when i try to get the sprite size or draw it, the variable is not recognized as a codeaimage.


ground = Ground(sprite("namehere")) --sprite is linked from library

-- or I try

ground = Ground(readImage("namehere")) -- again read from sprite library


Ground = class()


self.spriteTexture = spriteName

spriteSize(self.spriteTexture) -- I get an error that this is not a codea image



sprite(self.spriteTexture,x,y) --I get the same error here not a codeaImage



Looks a bit strange, can you share some more code?

Thanks for the reply tnlogy.
I was making up a small example and now its working with readImage() I believe I simply forgot to use “self.” 2 hours of frustration lol. simply stepping away and reworking it fixed the problem.

Thanks again for taking the time to read my post.

Nice that you solved it :slight_smile: