lua-users home
lua-l archive

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


My bad, I was just confused by why the Table * was called 'env'.  I thought it took on some special purpose for how userdata is handled within the Lua core, or if other functions made use of it.  For my purpose it would be only to make a GC association, but I can definitely see how it would be useful for your purpose.  "env" just sounded curious to me so I tried to see if it does more than lend itself to the uses of people who invoke the CAPI :-)


On Tue, Dec 3, 2013 at 11:25 PM, Kevin Martin <kev82@khn.org.uk> wrote:

On 3 Dec 2013, at 22:06, Sir Pogsalot <sir.pogsalot@gmail.com> wrote:

> As far as I see it's simply for use with get/setuservalue(), to make a GC association.

I'm not sure, but I think you're asking here if there is a use of setuservalue unrelated to the GC?

As an example I have a sqlite3 memory database wrapped in a userdata. In that database I want to be able to query certain objects that exist in Lua - this is done by creating an sqlite3 virtual table that knows how to query the Lua object, the Lua objects are stored in the userdata's user value (a table) so they can be accessed by the virtual table module.

Kev