lua-users home
lua-l archive

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

2008/10/10 Wesley Smith <>:
> local udata1 = Udata()
> local udata2 = Udata()
> local filename = "path/to/file.lua"
> function udata1:closing()
>    udata2:serialize(filename)
> end

2008/10/14 Wesley Smith <>:
> 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