Baffling script error

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bd525
Posts: 80
Joined: Sun Aug 31, 2014 12:43 am

Baffling script error

Post by bd525 » Sun Mar 05, 2023 7:47 pm

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
Attachments
Script Error.jpeg

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

Re: Baffling script error

Post by stam » Sun Mar 05, 2023 9:38 pm

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….

bd525
Posts: 80
Joined: Sun Aug 31, 2014 12:43 am

Re: Baffling script error

Post by bd525 » 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!

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

Re: Baffling script error

Post by stam » Mon Mar 06, 2023 3:25 am

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 ;) )

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”