This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Best way to parse a txt table
#3
(22.10.2018, 06:21)admin Wrote: Use this code to split last line data into a table:
Code:
data = ... -- get remote data

lines = data:split('\n')
line = lines[ #lines - 1 ] -- last line
line = line:gsub('%s+', ' ') -- remove multiple spaces
line = line:trim()
line = line:split(' ') -- convert to table

log(line)

Nice and clean, thank you!  Smile
Reply


Messages In This Thread
Best way to parse a txt table - by gtsamis - 19.10.2018, 08:30
RE: Best way to parse a txt table - by admin - 22.10.2018, 06:21
RE: Best way to parse a txt table - by gtsamis - 22.10.2018, 07:53

Forum Jump: