#134426 - 2005-02-24 10:00 AM
Re: A script has stopped working
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Quote:
I'm a little confused as to why it's telling me that the variable is undefined, as I explicitly define $count. If I move that line up to the top of the script, it then bugs me that $artist in line 32 is undefined...
Kind of.
You explicitly assign a value to the variable which implicitly declares it.
Explicitly declaring a variable can only be done with the DIM or GLOBAL statements (don't use GLOBAL).
The option SetOption("Explicit","ON") which is in one of your UDFs instructs KiXtart to handle undeclared variables as an error.
The "Explicit" option is global in scope and should never be set in a UDF unless the UDF also resets it to it's original value.
Having said that, *you* should set it at the top of your script and then declare all your variables. It's good coding practice, will enable you to track typos and bugs much more quickly and if you ever post to the UDF forum you will be required to explicitly declare all variables.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 1607 anonymous users online.
|
|
|