This question has two parts:
How would one generally parse a file with LuaTeX, assuming the file only holds data that is delimited either by spaces, commas or semicolons.
How would you parse the file (if it includes (all)TeX code as well as text code), for example an
inifile where some of the fields are written in TeX.
This question aims at finding a solution that is also well documented in the post. As LuaTeX is still in heavy development, I find the documentation to be sparse and this is the first of a number of questions that I intend to post (with bounties) so that the answers can provide some form of documentation on the web (and on our favourite Site!).
The first part is a simple CSV file. If you want you can use the example in my answer in
Adding a list of bios to the book class. As the answer included alpha sorting using TeX, it might be a good example, where LuaTeX should have an advantage over normal (all)TeX.
[general] languages=en,ngerman ;This is a comment [article] pagewidth=15cm pageheight=20cm paper=a4 [book] includeparts=true ;defines chapter [chapter] ;packages [graphicx] keys="keya,keyb,keyc"
For TeX code, add one command to the