So now I modify the condition to look like this:

   set the itemdelimiter to "."
   repeat for each item theOctet in theIPAddress
      if theOctet is empty or theOctet < 0 or theOctet > 255 then
         return "ERROR: Each IP Address octet must be a number between 0 and 
255. " & \
               "(ipaddress = " & theIPAddress & ")"
      end if
   end repeat

Note the check for the octet being empty. NOW it fails the condition every 
time. What this means is that sometimes the engine thinks empty is less than 0 
and sometimes it does not. Otherwise it means that sometimes an item which 
ought to be empty is not, and sometimes it is. Is this scaring anyone besides 
me? I am calling the function containing this code from the message box. I 
could go through the process of running it from a button but frankly having 
been able to force the engine to check for empty, I have solved the problem for 
now. But if anyone comes across something similar, it isn’t a gremlin. Or is 
it…???

Using version 6.7.0 build 5012

Bob S


On Jan 26, 2015, at 16:53 , Bob Sneidar 
<bobsnei...@iotecdigital.com<mailto:bobsnei...@iotecdigital.com>> wrote:

OK I think I have another script compilation. Given an IP address of 192.168..1

  set the itemDelimiter to “.”

  repeat for each item theOctet in theIPAddress
     if theOctet <0 or theOctet >255 then
        return "ERROR: Each IP Address octet must be a number between 0 and 
255. " & \
              "(ipaddress = " & theIPAddress & ")"
     end if
  end repeat

Should return an error on the third pass. It does not. Even though empty is in 
fact less than 0, it passes the condition! Oh but wait, it gets better.

I stepped through the code, and at first it passed, but then I put in a 
statement just before the condition:

     put theOctet is empty

On the third pass it put true into the message box then FAILED THE TEST! 
Subsequent calls to the function continued to fail! Then I stopped stepping and 
recompiled the script and saved it. IT STARTED PASSING AGAIN!!!!!

This is some crazy crap! The same code should not be behaving differently 
depending on whether or not I am stepping or not.

Bob S

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to