-- Function to generate a random color
function randomColor()
return {math.random(), math.random(), math.random(), 1}
end
-- Function to change the color of an object
function changeColor(object)
object:setFillColor(unpack(randomColor()))
end
-- Create a display object (e.g., a rectangle)
local myRectangle = display.newRect(display.contentCenterX, display.contentCenterY, 200, 200)
-- Change the color of the object every 2 seconds
timer.performWithDelay(2000, function() changeColor(myRectangle) end, 0)