title: Passing non-Global C++ objects to Lua functions (Swig)
body: <p>I am extending an interface with lua, and I've run into a problem in that I would need to pass pointers to objects to the lua code to work upon. These classes will have been wrapped via SWIG, and I could instantiate them via lua using swig, but that would leave me with useless objects.</p>
  
  <p>I need to be able to pass a callback object to lua, as well as objects representing things on events. I cannot manually define the callback as global because that would introduce a constraint which is unnacceptable.</p>
  
  <p>So for a generic example, given a class C and a function in lua that takes 1 parameter, how do I call that lua function while passing it the C++ pointer of type C?</p>