[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua table in a shared memory segment
- From: Javier Guerra Giraldez <javier@...>
- Date: Thu, 31 May 2012 12:35:30 -0500
On Thu, May 31, 2012 at 12:19 PM, Matthieu Tourne
> 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