Page 1 of 1

Baffling script error

Posted: Sun Mar 05, 2023 7:47 pm
by bd525
My stack of many hundreds of hours work was working just fine, then a script error has popped up that I can't make sense of. The error message is "compilation error at line <number> (Chunk: can't create a variable with that name..." (see attached)

If I comment out that line the error goes to the next perfectly good line of code.

If I comment out the entire handler the error goes to the first perfectly good line of the next perfectly good handler.

If I comment out the entire 2700+ lines of code in the stack script except for the "on" and "end" lines of the handler and a single line of code the error is still there on that single line of code. If I swap out the process with another line of code in that handler the error is still there.

I have no idea how to solve this. Is it corruption?

Bruce

Re: Baffling script error

Posted: Sun Mar 05, 2023 9:38 pm
by stam
Looks like you’re using strict compilation?
If that’s the case then you’re either using an undeclared variable or there is a typo in a variable name….

Re: Baffling script error

Posted: Sun Mar 05, 2023 10:00 pm
by bd525
Well, that's a bit embarrassing. I had gotten into the habit of not declaring local variables because Livecode allows that when Strict Compilation--which I knew nothing about--is not chosen in Preferences. It's a mystery how that got checked, but hey, there are plenty of mysteries in life. Thanks for your help, Stam!

Re: Baffling script error

Posted: Mon Mar 06, 2023 3:25 am
by stam
bd525 wrote:
Sun Mar 05, 2023 10:00 pm
Well, that's a bit embarrassing. I had gotten into the habit of not declaring local variables because Livecode allows that when Strict Compilation--which I knew nothing about--is not chosen in Preferences. It's a mystery how that got checked, but hey, there are plenty of mysteries in life. Thanks for your help, Stam!
No worries, we all done it ;)
Personally I prefer to use strict compilation because it picks up typos that can make things fail silently (I have an annoying habit that while I touch-type my right had is just quicker than the left so letters not infrequently are inverted - strict compilation picks these up for me and saves me personally a lot of headache - but each to his own ;) )