lua-users home
lua-l archive

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


>     __index    = db.get,

Oh, I thought you needed to get and set as methods, as in db:get(k).
If not, then your code is much nicer.

>       if k == "cursor" then return function() return db:cursor() end

Just do
	return setmetatable({
		cursor=function() return db:cursor() end
	},m)

Then neither __index nor __newindex will be called when the key is "cursor".