[ANN] LuaCSV (original) (raw)
![]() |
---|
[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]
- Subject: [ANN] LuaCSV
- From: steve donovan <steve.j.donovan@...>
- Date: Mon, 3 Aug 2009 13:33:55 +0200
Hi all,
Recently we were talking about CSV format again, and there was a suggestion that we needed a fast low-level extension [1]
Well, [2] is an attempt to supply that extension. It does the quoting rules correctly, as far as I can tell, but does not do the case where multiline records are encoded in double-quotes. That is an exercise for another day.
It provides an iterator, which returns the same table each time. So for a little inconvenience in some cases, one gets absolutely minimal hit on Lua memory. The returned table does have a copy() method, however.
By default, it looks at the first data line and works out whether they are to convertible to numbers. Thereafter, it keeps a mask of these fields and converts them. This will particuarly help you if you have a lot of numerical data to bring in. (You can always switch it off if it guesses incorrectly)
Tested on Debian 32-bit (gcc), and Windows XP (MS compiler). The zip contains a dll for those poor Windows souls without compilers.
steve d.
1 http://lua-users.org/lists/lua-l/2000-11/msg00134.html 2 http://mysite.mweb.co.za/residents/sdonovan/lua/luaCSV.zip
- Follow-Ups:
- Re: [ANN] LuaCSV, Shmuel Zeigerman
- Re: [ANN] LuaCSV, Thomas Lauer
- Re: [ANN] LuaCSV, Tobias Kieslich
- Prev by Date:Re: is it possible to make longjmp-free Lua?
- Next by Date:Faster cpcall and ENVIRONINDEX (was Re: is it possible to make longjmp-free Lua)
- Previous by thread:Re: Need some help here .. Had agood start...!!
- Next by thread:Re: [ANN] LuaCSV
- Index(es):