i don’t know why the texte is not aligne correctly
txt=string.format("%5d\\t%15.15s\\t%15.15s",num,ligne[1],ligne[2])
function setup()
displayMode(FULLSCREEN)
clearLocalData()
liste=listLocalData()
-- creer une liste vide
if #liste==0 then
for i=1,10 do
str=string.format("%2d",i)
str="name "..str
saveLocalData(str,math.random(1,300))
end
liste=listLocalData()
end
-- create table with scores and ligne#
scores={}
for num,ligne in pairs(liste) do
table.insert(scores,{readLocalData(ligne),ligne})
end
end
function draw()
background(39, 40, 50, 255)
fill(255, 0, 169, 255)
fontSize(40)
textMode(CORNER)
text("Place Score Name",300,550)
for num,ligne in ipairs(scores) do
txt=string.format("%5d\\t%15.15s\\t%15.15s",num,ligne[1],ligne[2])
text(txt,290,550-45*num)
end
end
function touched(touch)
if CurrentTouch.state==BEGAN then
table.sort(scores,function(a,b) return(a[1]>b[1]) end)
end
end