Posted 21 October 2014 - 06:26 AM
Hi, im developing a paint program for my OS, AppleOS, but iv'e ran into a snag, I almost got a save function/ something that memorizes where you click and what color, but its not letting my. Heres the code I used. First, i'll explain the 3 variables. Color is a variable in my paint program that whenever you click a color button, it changes the color to something like colors.red, or colors.green . X and Y is just where you clicked.
if(X >=51 and X <=52 and Y==1 and button ==1) then
color = colors.red -- color changing code
else
colorIndexNumber = colorIndexNumber + 1
clickIndexTable[colorIndex] = X,Y,color -- sets the table index
--[[ color index to where you clicked and the color, so if you clicked at 1,1 and the color is colors.green it sets click index table to 1,1,color, so at the end when it redraws what you made, it does
for a=1,#clickIndexTable do
paintutils.drawPixel(1,1,colors.red)
end
so, it should have done that, but it said expected X,Y and color.
--]]