lua-users home
lua-l archive

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

If you can limit the usage, I would implement this as a Voronoi dual class
userdata that provides the same set of methods as the const portion your
Delaunay binding.

To keep things safe from a GC standpoint, I would store a link to the base
Voronoi class in the environment for the userdata. That way, if the usage of
the dual object outlasts the usage of the Voronoi object, the appropriate
data will still survive.

If you worry about creating too many userdata objects because of frequent
access to the dual, you could use the environment for the Voronoi object
userdata to hold a reference to the dual. In fact, you could probably share
one environment table for the two objects.