How to tell whether a name is a var or array?
|> >The tcl "info" and "array" commands let me do this easily, with one
|> >odd exception; I can see of no built-in which lets me check to see
|> >if a variable "x" is a plain-jane variable, or an array.
|> You can do an 'array names var' command on vars that aren't arrays and
|> it will only return an empty string. Thus you can have this proc:
|> Works too (what a bonus).
Close, but no cigar. Try this:
set foo(bar) xxx
set doobry xxx
both work and
both fail. In fact, the test you're looking for is "array exists ..." and
array exists foo
array exists doobry
return 1 and 0 respectively. Take a look at parray ("info body parray"
after you've invoked it).
ISODE Consortium +44 181 332 9091
These are my opinions and have nothing to do with my employer.