lua-users home
lua-l archive

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


Lua syntax is wonderful, but can I use a Lua script as a very small database?

Suppose I have this example:

-- module A

configuration =

{

param1 = 10,

param2 = 11,

param3 = 13

}

Suppose the parameters are colors. In a set of options, the user can change the the colors of interface and the new values should be stored. How to save the values in a source code? Is it possible? Or you are mentioned it only for readable parameters?

The first time I call "require('module1')" configuration.param1 = 10. But the user said it will be 25. How to save it and recharge Module1 with the new value: configuration.param1 = 25?

If this is possible, Lua is much powerful and extraordinary than I could imagine!

What you said is really intersting.



----- Original Message ----- From: "Lucas Hermann Negri" <kkndrox@gmail.com>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Saturday, May 01, 2010 2:09 PM
Subject: Re: Non SQL databases


On Sat, May 1, 2010 at 1:45 PM, Luciano de Souza
<luchyanus@predialnet.com.br> wrote:
Hi listers,

Mysql and Firebird are excelent choice for large amount of data. If we want
a single database, Sqlite is very good, especially because a separated
process is not required. But I am curious to know if there is a non SQL
database compatible with Lua. I mentioned it because I knew Buzhug, a very simple non SQL database for Python. I think I will continue enjoying Sqlite,
but it seems interesting to know.

With Json, library for serialization, I can easily store configuration
parameters, but despite its undescribably utility, large amount of data will
probabily become the application slow, regarding a large table should be
created each time we call a set of fields. Json is better and easy to use
than ini files, but when a configuration file need also to be handle
manually, perhaps ini files will be better. I don't intend to leave Json
files, but I ask: if I want, I could also to deal with ini files?

I really love the large set of choices that Lua offers. Each head can adhere
to the prefered way.



Luciano de Souza

If you're looking for a simple substitute for configuration files or a
small database for your project, why not just use plain Lua scrits?
It's syntax is great for data definition, and it's already implemented.

--
http://oproj.tuxfamily.org