문제

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