here are three ways to iterate from t 'a' 'b' 'c' 'd' for i v in ipairs t do if i then print i v end end for i t do print i t i end for i e do where e million is larger than needed if not t i then break end print i t i end for a strange order use another table t 'a' 'b' 'c' 'd' color 'red' for v in ipairs 'color' do tabprint t v end by the way i use the following for accummulating results local function collection tab return a table to hold items tabreturn tabtabn tabtabadd function self item tabtabtabself n self n tabtabtabself self n item tabtabend tabtabjoin function self sep tabtabtabreturn table concat self sep tabtabend tab end local function work tablocal results collection tabfor i do tabtabresults add 'i ' i tabend tabreturn results join ' n' end local s work this is a string of lines