lua-users home
lua-l archive

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


Le 02/02/2012 20:23, Pierre-Yves Gérardy a écrit :
Using locals [...]That said, in this case, you don't usually
use a lot of database handles, and the memory overhead is not
important.

I've made the choice of using local functions on the top of declarations.

Even if it should'nt have many databases handles at the same time as you say, I'll try to keep the same style for other Lua modules I'll write. Memory efficience remains important.

Another thing:
   res, err = self._dbpath(new_db, path, ext)
would be better written as
   res, err = new_db:_dbpath(path, ext)
[...]

I've refactored with local but I've used to try this solution before and I've had a problem with it. Stop me if I'm wrong :

with `new_db:_dbpath(path, ext)`, self is passed as first parameter.
However, in the context of `open` method, self is lstore, not the new_db object. Thus, methods will operate on the global lstore, am I wrong ?

Version 0.1.1 is here : <https://projects.yaltik.net/lstore/info/4fc33f3047> .

Thanks again, Have a nice day.