I’m doing something wrong in the code below, but not quite seeing why.
local data = {}
for i = 1, 22 do
table.insert( data, data[i].title = "A title here")
end
I’m simply playing with table views, and want to practice with random numbers of rows.
So instead of setting up the table data manually:
local data = {}
--setup each row as a new table, then add title, subtitle, and image
data[1] = {}
data[1].title = "Hot Coffee"
data[1].subtitle = "Grounds brewed in hot water"
data[1].image = "coffee1.png"
data[1].rID = math.random()
data[2] = {}
data[2].title = "Iced Coffee"
data[2].subtitle = "Chilled coffee with ice"
data[2].image = "coffee2.png"
data[2].rID = math.random()
I’d like to create it from a loop. (even if the title, subtitle, and image are all the same)
The syntax error I’m getting back is:
Syntax error: c:\users…\main.lua:13: ‘>’ expected near '='
Can anyone see what I’m doing wrong in that first block of code? [import]uid: 154122 topic_id: 31258 reply_id: 331258[/import]