Pergunta

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.

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top