Hello everybody,
I hope that someone can help me,
I made a button that when pressed it create and display icons. Those icons can be dragged and moved everywhere up an image.
There is another button, a “save button”, that store the names of the icons (ex. “icon1,icon2,icon3…”) and the coordinates of the objects…
this is my code:
function saveImage(event) local json = require( "json" ) local path = system.pathForFile("data.db", system.DocumentsDirectory ) local db = sqlite3.open( path ) local tablesetup = [[CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY autoincrement, ImageName, icons);]] db:exec( tablesetup ) for i=icons.numChildren, 1, -1 do local child = icons[i] local childData = { child.name, child.x, child.y } local potsEncoded = json.encode( childData ) print( potsEncoded ) local pedalName = bloccoTesto.text local insertQuery = [[INSERT INTO test VALUES (NULL, ']]..pedalName..[[', ']]..potsEncoded..[[');]] db:exec( insertQuery ) end local function onSystemEvent( event ) if event.type == "applicationExit" then if db and db:isopen() then db:close() end end end Runtime:addEventListener( "system", onSystemEvent )
the problem is that in the SQL table “test” , the data is stored like showed in the attachment,
how can i do to put all the elements of the icons in the same row ?
example
image1 | [icon1, 124,150, icon2, 185.164]
thank you very much