【发布时间】:2012-05-19 20:28:20
【问题描述】:
如果我有这段代码,如何将循环值放入数组?
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
}
但我收到了这个错误:
unexpected symbol near 'for'
我只是想看起来像这样......
local data = {
{
song = "HI",
artist = "Tom"
}
{
song = "Hello",
artist = "mike"
}
...
}
谁能帮助我了解我的情况或提供一些建议? 提前致谢
【问题讨论】:
标签: arrays for-loop lua coronasdk