Is there a way in TCL to get the number of parameters that procedure accepts? For example we have procedure:

proc func {a} {
    puts $a
}

I need a way to put in variable the number of parameters that func procedure accepts.

有帮助吗?

解决方案

You could maybe try something like:

info args func

This will get the arguments that func require.

Then you can use it to get the number of arguments:

set num [llength [info args func]]

In your case, $num will be 1.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top