This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

not detecting variable as array. [SOLVED]

Help for those learning Tcl or writing their own scripts.
Post Reply
b
bradleylauchlin
Voice
Posts: 6
Joined: Mon Apr 14, 2008 8:02 pm

not detecting variable as array. [SOLVED]

Post by bradleylauchlin »

In one of my procs I do this:

set owner($chan) "$nick"
puthelp "NOTICE $nick :$owner($chan) is now the owner of $chan"

Then in another procedure I have this:

proc partchan {nick uhost hand chan {msg ""}} {
global owner
puthelp "NOTICE $nick :Leaving $chan whos owner is $owner($chan)."

When leaving the channel (bind triggers partchan) I get this in console:

[20:17] TCL error [partchan]: can't read "owner(#prem_vista)": variable isn't array

However, the first bit of code outputs correctly saying the correct username is the owner of the correct channel. So clearly the variable is an array there, and working. These are the only two snippets of code in which I even mention this variable.

Why does the second proc thing that it is not an array?
Thanks :)
Last edited by bradleylauchlin on Mon Apr 21, 2008 10:50 pm, edited 1 time in total.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

$owner is a global variable defined in your eggdrop's configuration file, which is not an array. Rename your array variable to something like "the_owner".
b
bradleylauchlin
Voice
Posts: 6
Joined: Mon Apr 14, 2008 8:02 pm

Post by bradleylauchlin »

Thanks so much, that resolved it :)
Post Reply