how can i put my looped value to an array if i have this code?
local data = {
for row in db:nrows("SELECT song.id, song.title as title, artist.name as name FROM song, artist where song.artist_id = artist.id") do
{
song = row.title,
artist = row.name
}
end
}
but i got this error:
unexpected symbol near 'for'
i just wanted to be look like this…
local data = {
{
song = "HI",
artist = "Tom"
}
{
song = "Hello",
artist = "mike"
}
...
}
can anyone can help me about my situation or give some advice about it?
thanks in advance
You would have to do something like this, I think:
Edit: A question though: Why don’t you just specify that in the SQL query and use the results as is? I.e.: