Operator malfunction

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Operator malfunction

Post by dunbarx » Fri May 13, 2022 4:57 pm

I had a modest "switch" statement in a handler. All of a sudden, it stopped working, that is, none of the case statements would fire. I could see nothing wrong with it. So I inserted a "case" test just before the switch (pseudo):

Code: Select all

if xyz is "true" then beep

switch
  case xyz = "true" 
    beep
break
...
I got a beep, but only one, the first one. Stepping through, flow passed right past the switch.

The only way out, and I had no idea it would work, was to rewrite from scratch the original switch construction. I did, and after that, everything worked fine. I got two beeps.

And OK, I know the thread title is a pervasive, insidious issue. I have suffered from it forever. I am not asking for anything.

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Operator malfunction

Post by richmond62 » Fri May 13, 2022 5:18 pm

I would hope that you kept your original code somewhere so
you can do a 'diff'.

As an expert at ballsing up code, while experience has not stopped from continuing to do that, it has taught me that there will be something that I overlooked.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Operator malfunction

Post by dunbarx » Fri May 13, 2022 7:04 pm

Richmond.

Great minds think alike.

Exactly the same length. Reads the same. I suppose I should do something like:

Code: Select all

repeat with y = 1 to the length of oldSnippet
  if char y of oldSnippet <> char y of newSnippet then destroyComputer
Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Operator malfunction

Post by richmond62 » Fri May 13, 2022 7:50 pm

Well, I would not destroy the computer, but I would ask the code
to signal you directly.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Operator malfunction

Post by dunbarx » Fri May 13, 2022 11:31 pm

Richmond.

That was my point. I did. The results were identical.

Craig

stam
Posts: 2679
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Operator malfunction

Post by stam » Sat May 14, 2022 1:33 pm

Can I ask
- did the malfunction persist after quitting and restarting LC
- does the issue persist if you extract the relevant code to a new empty stack?

On rare occasions I found that some weird subsystem has crashed silently with no notification to the developer and the only symptom is that code that used to work and should work doesn’t.

Post Reply

Return to “Talking LiveCode”