[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Feature request : More lightuserdata types
- From: "Soni \"They/Them\" L." <fakedme@...>
- Date: Tue, 22 Feb 2022 10:38:54 -0300
On 2022-02-22 10:24, 云风 Cloud Wu wrote:
>
>
> Flyer31 Test <flyer31@googlemail.com>于2022年2月22日 周二20:50写道:
>
> Why don't you just use "normal c userdata", if you want metafunctions?
> (I assume that in this case your userdata quite sure is anyway somehow
> "more important" / more "heavy"?).
>
>
> userdata is a GC object , and we don’t need lua manage the lifespan of
> objects.
>
> For example, we have a game scene graph in C side, only a few objects
> (when needed) export into lua side. So,not all C object has the lua proxy.
>
> Userdata is only a reference to scene node. We need another (weak)
> table to cache them. (Scene node pointer-> userdata)
>
> Another usecase is fixed-point number or complex number library. A
> value type is much cheaper than GC object.
>
>
>
You probably want a full userdata to avoid UB. LU aren't collected, so
you can't know if it's still alive or not/when to free it/etc.
"Optimizations" like these are a security nightmare.
>
>
>
> --
> http://blog.codingnow.com