[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Code Request: CSV parser written in Lua
- From: patrick.baur@...
- Date: Thu, 23 Nov 2000 09:39:46 +0100
Quick and dirty method I use:
dostring("fields={" .. the_line .. "}")
This will give you a table called fields that contains all the CSV-fields
in the string "the_line". You don't have to care for commas in strings (lua
does this for you) and you automatically get numbers, strings and nil as
appropriate. The index (table key) in "fields" corresponds to the field
position in the line:
foreachi(fields, print)