[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: String representation of a table
- From: tiago.tresoldi@...
- Date: Sat, 09 Aug 2003 14:32:36 -0300
Hello,
I've been working with Lua 5.0 in a quite complex open source proejct and have found a
problem that doesn't seem to mentioned before in the list (at least, I did't find
references).
I have been using Lua tables for a simple object programming - simple in terms of
implementation but quite complex in terms of contents. My tables usually contain about
ten variables each, including other tables. Worse, there are methods in every one of
them.
I would like to create a string representation of this tables, so that I could write a
representation of them in a file that could be loaded when needed. It is obviously
possible, but does not seem to right way to me, to write line by line, variable by variable,
the contents as in a configuration file. Also, writing a string that should be executed by
Lua (like "table = { a = 5, b = "a" }") could be easier but is a 'dirty trick' (not to mention
security problems). I have thinking about simple configuration files and methods that
would act like a constructor for my 'objects', but, before writing this code, I'd like to know
if someone has a solution for a problem like this.
Thank you,
Tiago Tresoldi