Is there a way to return (without crashing the procedure) whether a variable is set or not set? I need this specifically for array elements, but it would also be useful (and work in a similar manner) for normal variables.
I looked in the Tcl manual and could find nothing.
Can I declare a variable as an array without actually writing anything on it? I want a global array to be initialized within a procedure, but if I don't initialize it outside the procedure when I try to initialize it inside it returns the "not an array" error. I'm using "global arrayname".
Ok, nevermind. Rehash just didn't reset the variables properly. A restart solved it.
Also keep in mind, that the global-command really does'nt create, alter or otherwize directly affect any variable. All it does is link the local variable (within a proc) to the corresponding globalspace variable.
Right, but it was bitching about the previously untouched variable "not being an array" when I tried to set one of its members. unsetting the variable just prior to setting it was not an option because the procedure that set the variable was called several times to set different members - unsetting the variable before setting it would mean it would never have more than one member. Fortunately, it was just a problem of eggdrop not reseting the variables well.
Maybe I should've been alittle clearer, the code above was intended to initialize the variable upon reset/rehash, and not be used within various procs ("array set" will overwrite any existing data in the array).