[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: CSV File parsing
- From: "Richard Simes" <ricardo.nz@...>
- Date: Thu, 20 Jul 2006 12:31:23 +1200
Hi List,
I'm reading in some csv files with lua5.1 and noticed that the format of them can be easily translated into valid lua source:
1, 2, 3, 4
5, 6, 7, 8
could be loaded as a lua program if it was in the form:
tab = {
{ 1, 2, 3, 4 },
{ 5, 6, 7, 8 },
}
While writing a simple csv parser is not tricky ( and there's a perfectly good one here: http://lua-users.org/wiki/CsvHandling
)
It would be good for my purposes if I could use the lua interpreter to read the file - Some values are strings, some are functions and maybe tables.
Is there a way to temporarily change the way the lua interpreter works to add the necesary characters to the file as it's read?
preferably in lua, but C would be ok too.
I guess the translation could be part of a completely seperate process but would rather it wasn't.
Any Ideas?
Richard