comment excerpts from work in progress
One Lua motto is "mechanisms, not policies". As a matter of fact, Lua does not come with a predefined object model. Instead, it provides a thin layer of syntactic sugar (: and self) and a small set of powerful mechanisms (environments, metatables, closures and coroutines), that together allow a wide range of object flavours.
Since this is the Lua way, we must follow it in designing SWIG/Lua. This means we must provide flexiblity at some level between SWIG and Lua. On the other hand, we should take care not to make Lua too different from other SWIG target languages with respect to their module interface, which whould decrease reusability.
SWIG does offer a lot in terms of flexibility, but relying on SWIG typemap and directive tricks would clutter interfaces. In also involves writing some C, which is not what SWIG and Lua users are usually interested in !
This leads to the natural solution of implementing Lua-side wrapping specifics in Lua itself .
We offer the following basic mechanisms:
Stages 1 and 2 are straightforward. Stages 3 and 4 rely on declarative techniques for clarity and power.
 By contrast, the current official implementation of SWIG/Lua uses a single arbitrary object scheme that is hard-coded in C somewhere in the runtime SWIG library. Yes, the resulting modules can still be tweaked, but high-level information is already lost, and that is a brittle approach.