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.
Question
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.
La solution
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.