lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Wonderful! It's really wonderful. When I mentioned I would like something really simple, I could not imagine how simple it would be! With Data e Json, I could do everything I wanted.

I always admire Python for the simpliicity. For the same reason, I admire Lua. I have started in Lua because of IUP. Now I can't imagine to adopt another language.

A gift... What you sent me was a gift.

There is choices more complicated, adopted by people I respect. But I am sure that for my simple needs, Data and Json are perfect. Both are excelent.

Thank you!

----- Original Message ----- From: "Petite Abeille" <>
To: "Lua list" <>
Sent: Sunday, March 07, 2010 5:54 PM
Subject: Re: Saving a table in file

On Mar 7, 2010, at 7:09 PM, Luciano de Souza wrote:

But, how to save it in a file?

As mentioned, you need to serialize (i.e. create a string representation) your table.

For example:

local Data = require( 'Data' )

-- save the content of table 't' to file 't.txt'
Data[ 't.txt' ] = t

-- load the content of file 't.txt' into variable 't'

t = Data[ 't.txt' ]

-- print the content of table 't' as a string
print( Data( t ) )

_[1]["city"]="São Paulo"
_[4]["country"]="United States"