[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_setuservalue() - what is it for?
- From: Marc Balmer <marc@...>
- Date: Fri, 21 Aug 2015 14:03:25 +0200
Am 21.08.15 um 03:53 schrieb Daurnimator:
> On 21 August 2015 at 09:27, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
>> Apologies for this very basic question. What is the purpose (i.e. use
>> case) of the lua_setuservalue() api?
>
> To tie other lua values to a userdata.
> Some use cases:
> - have a simple reference to the parent object of a userdata
> - to keep lua values for a userdata (e.g. a callback)
>
> e.g. I have an open PR to luapgsql that uses a uservalue to keep a
> reference to the lua FILE object you pass:
> https://github.com/mbalmer/luapgsql/pull/24/files
>
Thansk for the reminder, I will definitely put that in (and also create
a new release, while there...)
- m.