[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: newproxy, bug
- From: GrayFace <sergroj@...>
- Date: Sun, 16 Jan 2011 04:30:41 +0600
On 14.01.2011 16:29, Jonathan Castello wrote:
For what it's worth, I like to use debug.setfenv/debug.getfenv with a
newproxy() userdata to store private data with an object from Lua.
There's no way to do this with tables (that I know of) except with a
relatively clunky local table where the keys are objects and the
values are the private data.
The way I came up with is to store the table with private variables in a
special key that's skipped by 'next'. The key is a local object, so it
can't be found otherwise. I even made the attached script back then,
which allows any script to have its own set of private variables in any
table. I haven't published it though.
--
Best regards,
Sergey Rozhenko mailto:sergroj@mail.ru
Attachment:
RSHidden.lua
Description: luaedit/luaedit.lua
- References:
- newproxy, bug, joao lobato
- Re: newproxy, bug, Roberto Ierusalimschy
- Re: newproxy, bug, Javier Guerra Giraldez
- Re: newproxy, bug, Geoff Leyland
- Re: newproxy, bug, Mike Pall
- Re: newproxy, bug, Geoff Leyland
- Re: newproxy, bug, Florian Weimer
- Re: newproxy, bug, Geoff Leyland
- Re: newproxy, bug, Jonathan Castello