lua - get the list of parameter names of a function, from outside the function

前端 未结 4 1816
小鲜肉
小鲜肉 2021-01-01 07:31

I\'m generating some (non-html) documentation for a Lua library that I developed. I will generate the documentation by hand, but I\'d appreciate some kind of automation if p

4条回答
  •  误落风尘
    2021-01-01 07:48

    Take a look at debug.getinfo, but you probably need a parser for this task. I don't know of any way to fetch the parameters of a function from within Lua without actually running the function and inspecting its environment table (see debug.debug and debug.getlocal).

提交回复
热议问题