lua-users home
lua-l archive

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


> Well, Wesley, I don't see the point. This code about weak table is not
> really interesting and it is evident that I'm creating the weak table
> elsewhere. I'm not sure that your comments about my code which is
> hairy are really justified.
>

Sorry.  I wasn't trying to disparage your code, but just point out
that the code you posted doesn't show how lines related to plots in
terms of using Lua for reference counting without a lot of extra
information.

> Of course I accept the criticisms and I'm absolutely sure that in many
> area the design could be simplified by changing some strategic choice.
>
> I'm just struggling to get something simple and elegant to manage the
> graphical elements and what I'm seeing is that the only acceptable
> answer is reference counting.
>

I think the problem you're running in to as I said before is that
there is no clear line of ownership in the C++ classes, so the user
has to manage it.  If that's the case, you can make an abstraction
layer in C++ that does this without involving Lua (this is the idea of
the factory in my previous email), implement something like reference
counting that that the userdata knows when it's safe to free itself,
or push the responsibility on to the Lua scripter, which is probably
not so nice since the user will have to manually untangle objets that
depend on each other.

wes