[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: serializing lua tables
- From: PA <petite.abeille@...>
- Date: Mon, 21 Mar 2005 17:12:30 +0100
On Mar 21, 2005, at 16:59, Adrian Sietsma wrote:
i have lua read-write configs, but i'd like to keep the config format
and comments.
What about perhaps reading your configuration file line by line into a
table array to preserve all the content as well as the ordering. Out of
this array, you could extract the configuration lines themselves by
splitting each lines which are not comments into key value pairs. This
gives you the configuration itself. After modifying a value, you can
rewrite your configuration file as it was originally by merging the
changes into the table array. That way you could preserve both ordering
and comments. The only issue left is where to put new key value pairs.
Perhaps dumping them at the end of the configuration file would be good
enough?
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/