lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I've got an array of rotating adverts, each one has a lineup of ads it will go through. So I made a double-dimensioned array.

So:

local ad_lineup ={}
ad_lineup.ad1 ={}	-- ad 1 lineup (*)
ad_lineup.ad1[1] = "CoolWhip"
ad_lineup.ad1[2] = "ShreddedWheat"
ad_lineup.ad1[3] = "Swiffer"

ad_lineup.ad2 ={}	-- ad 2 lineup (*)
ad_lineup.ad2[1] = "ShreddedWheat"
ad_lineup.ad2[2] = "Swiffer"
ad_lineup.ad2[3] = "Yumos"
ad_lineup.ad2[4] = "Concierge"
ad_lineup.ad2[5] = "foo"

ad_lineup.ad3 ={} -- ad 3 lineup (*)
ad_lineup.ad3[1] = "NeedHelp"

Something tells me there is a more appropriate way to do this. In particular, do I need to declare each ad lineup "column" as a table in its own right? (see (*) lines above)



Dave Collins
Front-End Engineer
Mercatus Technologies Inc.
60 Adelaide Street East, Suite 700
Toronto ON M5C 3E4
T  416 603 3406 x 298
F  416 603 1790

dave.collins@mercatustechnologies.com
www.mercatustechnologies.com