lua-users home
lua-l archive

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


On Thu, May 31, 2012 at 12:19 PM, Matthieu Tourne
<matthieu.tourne@gmail.com> wrote:
> Is there a way I could create a Lua table in shared memory, or expose
> a table like interface so I could store Lua object in my shm segment ?

it's quite easy to add the hooks to the metatable, try something like
this, where 'obj' is any 'DICT' object.  usually all objects share the
same metatable, so you just have to do this once and every DICT object
should get the new behaviour.

local mt = getmetatable(obj)
mt.__index = mt.get
mt.__newindex = mt.set

-- 
Javier