lua-users home
lua-l archive

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


2010/10/19 Wesley Smith <wesley.hoke@gmail.com>:
> It's extremely hard to follow your weak table code, which is maybe why
> you didn't post it before.  I still don't wee where your weak table
> is.  There's no __mode field set in what you post, and I imagine from
> this code that the rest of your code is pretty hairy.  If you could
> draw a diagram showing dependencies, it might help, but it's my
> opinion that you really need to simplify this stuff.

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.

>
> I'm not sure why you have lines and transforms represented as objects
> in the first place, but assuming that's a desirable feature, you are
> going to either have to have a reference counting mechanism or a clear
> line of ownership modeled in lua using the environment table of a
> userdata.  For this last case, you could have Plot act as a factory
> for Lines and Transforms.  Plot owns those objects.  When they're
> pushed in to Lua, their userdata is linked to the Plot environment
> table, preventing them from being collected if no longer referenced in
> a script.  When Plot is collected the Line and Transform userdata do
> not free the underlying C++ structures because it's Plot's job to do
> that.

Please look at this video to see what my application can do right now
and may be you will be more understanding :-)

http://dl.dropbox.com/u/1156356/out.ogv

Please note that the 3D graphics is much more smooth in reality then
what is shown in the video :-)

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.

-- 
Francesco