You can maybe do something like:
local redis = require "resty.redis"
local _M = {}
local mt = { __index = _M }
function _M.new()
return setmetatable({ _parent = redis.new()}, mt)
end
function _M.connect(self)
.. do something with self
local ok, err = self._parent:connect()
...
end
You'd need to "wrap" each function. You could probably do a little metatable indirection to call other functions in the "parent" without having to override each call.