class 'bind0'
class 'bind1' (bind0)
class 'bind2' (bind1)
class 'bind3' (bind2)
class 'bind4' (bind3)
class 'bind5' (bind4)

function bind0:__init(Method, Object)
    assert(Method and Object)
    self.Method = Method
    self.Object = Object
end

function bind1:__init(Method, Object, arg1)
    super(Method, Object)
    assert(arg1)
    self.arg1 = arg1
end

function bind2:__init(Method, Object, arg1, arg2)
    super(Method, Object, arg1)
    assert(arg2)
    self.arg2 = arg2
end

function bind3:__init(Method, Object, arg1, arg2, arg3)
    super(Method, Object, arg1, arg2)
    assert(arg3)
    self.arg3 = arg3
end

function bind4:__init(Method, Object, arg1, arg2, arg3, arg4)
    super(Method, Object, arg1, arg2, arg3)
    assert(arg4)
    self.arg4 = arg4
end

function bind5:__init(Method, Object, arg1, arg2, arg3, arg4, arg5)
    super(Method, Object, arg1, arg2, arg3, arg4)
    assert(arg5)
    self.arg5 = arg5
end

function bind0:__call(...)
    local err, message = pcall(self.Method, self.Object, ...)
    if err == false then
        Log(message)
    end
end

function bind1:__call(...)
    local err, message = pcall(self.Method, self.Object, self.arg1, ...)
    if err == false then
        Log(message)
    end
end

function bind2:__call(...)
    local err, message = pcall(self.Method, self.Object, self.arg1, self.arg2, ...)
    if err == false then
        Log(message)
    end
end

function bind3:__call(...)
    local err, message = pcall(self.Method, self.Object, self.arg1, self.arg2, self.arg3, ...)
    if err == false then
        Log(message)
    end
end

function bind4:__call(...)
    local err, message = pcall(self.Method, self.Object, self.arg1, self.arg2, self.arg3, self.arg4, ...)
    if err == false then
        Log(message)
    end
end

function bind5:__call(...)
    local err, message = pcall(self.Method, self.Object, self.arg1, self.arg2, self.arg3, self.arg4, self.arg5, ...)
    if err == false then
        Log(message)
    end
end

function bind(Method, Object, arg1, arg2, arg3, arg4, arg5)
    if arg5 then return bind5(Method, Object, arg1, arg2, arg3, arg4, arg5)
    else if arg4 then return bind4(Method, Object, arg1, arg2, arg3, arg4)
    else if arg3 then return bind3(Method, Object, arg1, arg2, arg3)
    else if arg2 then return bind2(Method, Object, arg1, arg2)
    else if arg1 then return bind1(Method, Object, arg1)
    else return bind0(Method, Object) end end end end end
end