| View previous topic :: View next topic |
| Author |
Message |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Wed Mar 24, 2010 5:41 pm Post subject: |
|
|
The code still expects the supplied data to be a list, so using a string with the loadscript proc would still be "improper". Still, as long as you're very careful, you'll be safe.
The list commands used with uplevel (since user's fix) is used to avoid something known as double-evaluation, it does not affect the data passed to the foreach command, which still has to be a valid list.
The problem you are facing with "set scripts [list ... ]" is that you don't properly escape the newline character using \
Wrong:
| Code: | set scripts [list
scripts/script1.tcl
scripts/script2.tcl
scripts/script3.tcl
] |
Correct:
| Code: | set scripts [list \
scripts/script1.tcl \
scripts/script2.tcl \
scripts/script3.tcl \
] |
It is vital that there is no space or other charactes after the \ before the newline.
Whenever a string is evaluated (in this case due to []), a newline means end of command-line, and the first word on the next line is treated as a new command. Escaping the newline prevents this, and lets us span a single command-line over several lines. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Thu Mar 25, 2010 1:38 am Post subject: |
|
|
well, know what? lol
i put a space after \ because of two reasons:
1. it seemed quite logic to me to escape a space char with \ so its really being treated as one
2. try to select that code of yours with your mouse and you'll notice that \[code\] puts a space after the \
plus, i made an important mistake, i didnt put a \ after the first line that contains "set scripts [list"
but wow .. im impressed because everything is working again and the mistakes were more of a minor matter. thx again for help (cant say that often enough ^^) |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Mar 25, 2010 10:24 am Post subject: |
|
|
Ahh, one more converted
I believe those spaces were due to your browser; I've seen some browsers adding them on the fly, while others (like mine) don't. Unfortunately, it becomes a somewhat complicated structure when you want to do it proper, yet have one item per line. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Thu Mar 25, 2010 1:09 pm Post subject: |
|
|
k-meleon here ^^
and yup, thats probably why then, weird things are happening on the internet lol |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|