lua-users home
lua-l archive

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


On 24 April 2012 20:56, Coda Highland <chighland@gmail.com> wrote:
> On Tue, Apr 24, 2012 at 1:49 PM, Michal Kottman <k0mpjut0r@gmail.com> wrote:
>> On 24 April 2012 20:33, Jorge <xxopxe@gmail.com> wrote:
>>> Anything that is referenced in the the global "persistent" table will be
>>> swapped.
>> ....
>>> Persisting then would mean keeping between restarts.
>>
>> Some of what you want is already described here:
>> http://lua-users.org/wiki/TableSerialization
>>
>> For example, serialization using SQLite is described here:
>> http://lua-users.org/wiki/PersistentTablesSqlite
>>
>> You are using Lua tables, and all reads/changes are redirected to the
>> SQLite database. Some more metatable magic, and you could get a fully
>> "persistent" state as you describe (e.g. automatic "new_table()" and
>> "get_table()").
>>
>
> Ugh, why SQLite? I like SQLite for relational data, don't get me
> wrong, but you'd be much better off using Kyoto Cabinet (if GPL3 is
> not an issue) or Tokyo Cabinet (if it is) because those are MUCH more
> appropriate for this kind of data and many orders of magnitude faster.

I was never suggesting that SQLite is a good idea performance-wise,
just to server as a simple example of how it could be done.
Tokyo/Kyoto Cabinet also has a Lua interface which mimics Lua table
behavior, which is backed by a DBM, so it could be used in this
context too.