Luabridge: Returning C++ lifetime managed object
问题 This snipped works for basic types: int CreateBasicObject(lua_State *L) { int ret0; lua_pushinteger(L, ret0); return 1; } and in lua it looks like this: local NewObject=CreateBasicObject() How would I go about returning classes instead of ints ? push(L,&MyObject); return 1; does not seem to work correctly, lua portion looks like this: self.MyObject=Screen.MyObject(); And the error is: attempt to index field 'MyObject' (a number value) 回答1: In the newest LuaBridge version you can use