arrays - Lua - parse from text file and store values with different length -


i beginner in programming lua, , stuck reading text file , trying store in array. know there exists topic this, wondering how should store lines different amount of numbers. eg: in textfile:

1 5 6 7 2 3 2 9 8 1 4 2 4 

how make array this? solutions find identical amount of numbers.

local tt = {} line in io.lines(filename)    local t = {}    num in line:gmatch'[-.%d]+'       table.insert(t, tonumber(num))    end    if #t > 0       table.insert(tt, t)    end end 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -