hello all,
I'm in my second day of programming lua and i need help.
I'm just doing a basic "drawing" program for my PSP trying too get better
I came form doing a similar program on 'qbasic and i cant get the screen to clear when I press R trigger

in using luaplayer euphoria V8 and here is my code

**************************************************
--variables
blue = Color.new(0, 0, 225)
green = Color.new(0, 225, 0)
red = Color.new(225, 0, 0)
white = Color.new(225, 225, 225)
x=100
y=100
z=0
--starting point and instructions
screen:print(x, y, "O", red)
screen:print(10, 10, "cross is blue, triangle is green, circle is red", white)
screen:print(20, 20, "and square resets the cursor", white)
screen:print(200, 200, "BY NICK COCHRAN", white)
--main program
while true do
pad = Controls.read()
if pad:r() then
screen:clear()
end
if pad:up() and z == 0 then
y=y-1
screen:print(x, y, ".", red)
end
if pad:down() and z == 0 then
y=y+1
screen:print(x, y, ".", red)
end
if pad:left() and z == 0 then
x=x-1
screen:print(x, y, ".", red)
end
if pad:right() and z == 0 then
x=x+1
screen:print(x, y, ".", red)
end
if pad:square() then
x=100
y=100
screen:print(x, y, "O", red)
end
if pad:triangle() then
z=1
end
if pad:cross() then
z=2
end
if pad:circle() then
z=0
end
if pad:up() and z == 1 then
y=y-1
screen:print(x, y, ".", green)
end
if pad:down() and z == 1 then
y=y+1
screen:print(x, y, ".", green)
end
if pad:right() and z == 1 then
x=x+1
screen:print(x, y, ".", green)
end
if pad:left() and z == 1 then
x=x-1
screen:print(x, y, ".", green)
end
if pad:up() and z == 2 then
y=y-1
screen:print(x, y, ".", blue)
end
if pad:down() and z == 2 then
y=y+1
screen:print(x, y, ".", blue)
end
if pad:right() and z == 2 then
x=x+1
screen:print(x, y, ".", blue)
end
if pad:left() and z == 2 then
x=x-1
screen:print(x, y, ".", blue)
end
screen.flip()
screen.waitVblankStart()
end
*******************************************************************************
plz help a noOp
PS: Ill add your name to it if you can help if you want