lua-users home
lua-l archive

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

>> With the closure method, counter:inc() should be;

Hi Joao,

I dont need any Object encapsulation or such, I am looking for the most efficient way to store alot of lua objects in a nested table.

The lua table has the following dimensions
1.) relational_table_name
2.) relational_column_name
3.) relational_primary_key
4.) element_within_lua_table

So in the relational table "rtbl" there would be a column called "lobj" which is actually a lua-table.
Within this lua-table, the element "age" would be dimension #4.
In the relational table, the primary keys 123 & 124 would have lua tables and would be adressable by something like
ASQL["rtbl"]["lobj"][123].age=25 (the age of user 123)
ASQL["rtbl"]["lobj"][124].age=35 (the age of user 124)

This data lobj.age can then be change via Lua calls, and also via SQL calls that know how to find the row. Additionally lobj.age can be indexed w/in AlchemyDB's SQL engine.

This is all pretty complicated, but it works (I tested it last night) and it is a new type of document store.

Here is the lua code I wrote last night

This code is ProofOfConcept code, it is not optimised for CPU usage or memory usage, and I need some advice on how to make it very lean w/ memory and very quick w/ cpu usage

I hope this makes sense