title: C++ LuaBridge attempt to index a userdata value (local 'self')
body: <p>I've created a wrapper around LuaBridge in my framework, so that I can easily swap out LuaBridge for an alternative library. I have certain classes that get registered with LuaBridge as part of my framework initialization. I can then access or instantiate those classes easily in Lua. The problem comes when I want to call a custom method on a class/table, that has already been registered in the framework init, that I've defined in Lua.</p>
  
  <pre><code>function MyObject:OnUpdate()
    self:Init()
  end
  </code></pre>
  
  <p>If I try and call OnUpdate with passing an instance of MyObject, so that I can utilize self, I get the following error:</p>
  
  <p>"attempt to index a userdata value (local 'self')"</p>
  
  <p>If I register MyObject manually instead of allowing my framework to initialize it during startup, it works perfectly. It's like Lua can resolve the metatable of MyObject even though I can clearly see it defined. I also can't seem to find much on that exact error from Lua.</p>