Script not accepting empty line

Jeremy Smith helloc66 at hotmail.com
Wed May 26 22:36:44 EDT 2004


Just recently I noticed a very strange 'bug'(?) in my code that I really 
can't figure out.... There is a repeat script that checks each line of a 
variable to see if it is empty, if it is then add data to that line. Certain 
events will empty a random line (so line 2 would be empty but lines 1,3,4,5 
etc.. are full).

The script doesn't recognise the line as empty though, but if I copy the 
exact line and put answer in front of it in the message box I get back 
"True"... Why would the messagebox return true while the script returns 
false?

I tried two other methods to check for an empty line, the first was to do an 
if statement and if true was returned for an empty line then continue. That 
didn't work, so I put a check to see if item 1 of the line was empty.. That 
worked!?!

In case the above doesn't make sense here is an example code (I haven't got 
the code with me to paste sorry).

------

This script will add data to lines 1 to 10 but then when lines are emptied 
only line 10 will fill back up.

on Add_New
repeat with x = 1 to 10
if line x of variable is empty then
Add some data to the line here
end repeat
end Add_New

This returns true, and is the exact line (minus the if) from the above 
code!??
answer (line x of variable is empty)

Cheers.
Jeremy.




More information about the use-livecode mailing list