且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

lua-从函数外部获取函数的参数名称列表

更新时间:2023-11-15 13:58:40

看看 debug.getinfo ,但是您可能需要一个解析器来执行此任务.我不知道没有任何方法可以从Lua内部获取函数的参数,而无需实际运行该函数并检查其环境表(请参见 debug.getlocal ).

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).