How to use getPixel, getColor Method in lua

1.6k views Asked by At

Can someone please show me the correct way to use getPixel and getColor in lua. I tried

 pix = 5; piy = 5;
 getPixel(pix, piy) --getColor(pix, piy)

 image:getPixel(pix, piy) --image:getColor(pix, piy)

...and I just can't figure out what lua is complaining about.

error: attempt to call global 'getPixel' (a nil value)

1

There are 1 answers

0
Piglet On BEST ANSWER

Can someone please show me the correct way to use getPixel and getColor in lua.

Lua does not provide a function to get pixels or colours. Again, as in your earlier questions, this is something you'll find in the Gideros manual.

getPixel(pix, piy) --image:getColor(pix, piy)

...and I just can't figure out what lua is complaining about.

error: attempt to call global 'getPixel' (a nil value)

Lua complains about you calling a nil value. There is no variable named getPixel in your global environment.

So once again open the Gideros manual:
http://docs.giderosmobile.com/reference/gideros

Then for example click Pixel in the left menu:
http://docs.giderosmobile.com/reference/gideros/Pixel#Pixel