函数返回的结果是函数的返回的结果不是函数


function read(self)
    print("key:"..self.key)
end


enable = function(func)
      self = {key='value'}
      local fn = func 
      if type(fn) == "function" then
        return fn(self)
      end 
end

enable(read)


function test()
    print("test")
    return true 
end

params = function(func)
    if func == false then
        return function() print('params error') end 
    end 
    return function(request, id) 
        print("request")
    end 
end

ret = params(test())
ret()


function json(func)
    if type(func) == "function" then 
        print('json')
        return func
    end 
end

function get(request, id) 
        print('get')
end 


ret = json(get)
ret()


function pprint(self, ...)
    print(self)
    print(...)
end

pprint("test pprint", 1, 2, 3)