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.
function MyObject:OnUpdate()
self:Init()
end
If I try and call OnUpdate with passing an instance of MyObject, so that I can utilize self, I get the following error:
"attempt to index a userdata value (local 'self')"
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.