@hohohohoho Since all you want to do is save colors that are in a table to memory (project), this will work. Just use whichever function to do what you want.
function setup()
col={} -- table for colors
-- Use this the first time to create and save the color table
col={ {64, 48, 37, 255},
{102, 78, 50, 255},
{0, 0, 0, 255},
{70, 34, 30, 255},
{184, 161, 125, 255} }
saveTable()
-- use this to read the table from memory and create the color table
readTable()
-- use this to add more colors to the color table
updateTable(255,0,0,255)
-- use this to remove a color position from the color table
removeTable(3)
-- use this to save the color table to project memory
saveTable()
end
function draw()
background(0)
for z=1,#col do -- draw circles showing the colors in the table
fill(col[z])
ellipse(250,HEIGHT-50*z,45)
end
end
function saveTable()
local temp={}
for z=1,#col do
temp[z]={col[z][1],col[z][2],col[z][3],col[z][4]}
end
saveProjectData("colorTab",json.encode(temp))
end
function readTable()
local hc=json.decode(readProjectData("colorTab"))
for t=1,#hc do
col[t]=color(hc[t][1],hc[t][2],hc[t][3],hc[t][4])
end
end
function updateTable(r,g,b,a)
table.insert(col,color(r,g,b,a))
end
function removeTable(pos)
table.remove(col,pos)
end