Search code examples
luagideros

How to use getPixel, getColor Method in lua


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)


Solution

  • 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