Hello, Hey, it's really fun to code in lua: pattern matching, easy table manipulation and so on, I should have learned it earlier! Since it's my first experience with lua, I would like to ask you for comments on the t-inifile.tex module, attached to this message. I tried to implement a demo-mode, but there are two small problems: - I don't know how to use \savebuffer, all line-endings disappear in the saved file - the utf-thinspace is ignored Cheers and thanks a lot to the luatex and MKIV developers! Peter -- http://pmrb.free.fr/contact/
Hi Peter, On Mon, 25 Feb 2008, Peter Münster wrote:
Hello,
Hey, it's really fun to code in lua: pattern matching, easy table manipulation and so on, I should have learned it earlier!
Looks interesting.
Since it's my first experience with lua, I would like to ask you for comments on the t-inifile.tex module, attached to this message.
I tried to implement a demo-mode, but there are two small problems: - I don't know how to use \savebuffer, all line-endings disappear in the saved file
You can do something like \startbuffer[thewho] contents of the ini file \stopbuffer This will create a file \jobname-thewho.tmp which you can then read. Aditya
On Mon, Feb 25 2008, Aditya Mahajan wrote:
I tried to implement a demo-mode, but there are two small problems: - I don't know how to use \savebuffer, all line-endings disappear in the saved file
You can do something like
\startbuffer[thewho] contents of the ini file \stopbuffer
This will create a file \jobname-thewho.tmp which you can then read.
Hello Aditya, This is only true for MKII. Cheers, Peter -- http://pmrb.free.fr/contact/
Peter Münster wrote:
Hello,
Hey, it's really fun to code in lua: pattern matching, easy table manipulation and so on, I should have learned it earlier!
Since it's my first experience with lua, I would like to ask you for comments on the t-inifile.tex module, attached to this message.
I tried to implement a demo-mode, but there are two small problems: - I don't know how to use \savebuffer, all line-endings disappear in the saved file - the utf-thinspace is ignored
Cheers and thanks a lot to the luatex and MKIV developers!
i have no time to look into it ... a few comments ... inifile = {} ^^^ there are three predefined namespaces: userdata = userdata or { } thirddata = thirddata or { } document = document or { } in your case, use thirddata.inifile = { } -- just for debugging: print the table to stdout local function print_table() for i = 1,#inifile.t do print("") print(i, inifile.t[i].key) for k, v in pairs(inifile.t[i]) do print("", k, v) end print("") end end just do: print(table.serialize(thirddata.inifile.t) (there are quite some helpers defined in l-string, l-table cum suis) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Tue, Feb 26 2008, Hans Hagen wrote:
in your case, use
thirddata.inifile = { }
[...]
just do:
print(table.serialize(thirddata.inifile.t)
(there are quite some helpers defined in l-string, l-table cum suis)
Thank you, Hans, for your fast reply, these are already 2 useful hints! Cheers, Peter -- http://pmrb.free.fr/contact/
participants (3)
-
Aditya Mahajan
-
Hans Hagen
-
Peter Münster