How can I add more rows to this table?

Hi everyone,

I know how to create a table such as table1={} and then do table1[1] = “abc” and table1[2] = “def” and so on. But I do not know how to add multiple rows to the way I am doing it below. I am adding a record and then submitting the data to my server but only doing one row at a time while looping through the records of an SQLite table. I would like to add multiple rows and then encode and submit the data. Can someone show me how to change the code below to do that? Thanks a lot!

Warren

local foo = {} foo.trip = { {TripID=TripID2, mileage=mileage2, statename=statename2, datemade=datemade2} } local encode = json.encode (foo)
local foo = {} for i = 1, 10 do local row = {something = "A", somethingElse = "B"} table.insert(foo, row) end local encoded = json.encode(foo)

Thanks, I’ll give that a try. I was doing foo.trip. Is there any way to keep that somehow with your code because when I read it in I was using trip in that code also.

If you look at my first post I have foo.trip. How can I do this with your example? I tried everything and it fails.

Warren

local foo = {} for i = 1, 10 do local row = {something = "A", somethingElse = "B"} table.insert(foo, row) end local encoded = json.encode(foo)

Thanks, I’ll give that a try. I was doing foo.trip. Is there any way to keep that somehow with your code because when I read it in I was using trip in that code also.

If you look at my first post I have foo.trip. How can I do this with your example? I tried everything and it fails.

Warren