[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: __gc and userdata order of collection issues
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Tue, 14 Oct 2008 11:52:44 +0200
2008/10/10 Wesley Smith <firstname.lastname@example.org>:
> local udata1 = Udata()
> local udata2 = Udata()
> local filename = "path/to/file.lua"
> function udata1:closing()
2008/10/14 Wesley Smith <email@example.com>:
> Hi Jerome.
> Thanks for the response. I see what you're getting at.
>> Such an order is simple enough to understand so you can take it into
>> account in your code to avoid the problem you have in your example.
>> Here you would have to create the serializer before any userdata that
>> may use it in their finalizer.
> I hadn't thought of a serializer and I may need it yet,
I was referring to the udata2 object from your example (see above)
which have a serialize method.
> but right now,
> the issue happens between modules no within modules so I can't solve
> this instance of the problem with such a device.
In your original example, both userdata are created with the same
module, and swapping their creation order solves the problem. Can you
give an example of code using multiple modules that still have issues