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 -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -