[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Does lua_setuservalue reference the value?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Sun, 13 Dec 2015 16:33:39 -0200
> When I set a function argument as the uservalue of a userdata object, is that value automatically being referenced (like luaL_ref()) and will thus not be auto-gc'ed?
>
> And if so, when the userdata is later being gc'ed, will the refercen to the uservalue be un-refed?
The uservalue of a userdata is like any other reference (e.g., a table
field). So, yes and yes. (But there is nothing special goin on; both
cases are just how regular references work.)
-- Roberto