You cannot test too much

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: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

You cannot test too much

Post by dunbarx » Mon Sep 27, 2021 4:24 am

Where have I heard that before?

I made a scrabble scoring and tile tracking program, and found that my code threw an error when I invoked one of its features. That feature allows the player to modify an earlier play, assuming that he later discovered that he entered that earlier play incorrectly.

But this happened only once, and I could not replicate it. Then I remembered that the error occurred when I entered the string "or" for the incorrect string. The string "or" was in the local variable "it", and this line of code barked:

Code: Select all

do "put" && toUpper(it) && "into line" && tLine && "of fld" && tTarget -- 'it" contained "or"
The string "or" threw LC into a fit, and it is easy to see why. Fixing it only required that I:

Code: Select all

do "put" && quote & toUpper(it) & quote && "into line" && tLine && "of fld" && tTarget
make sure that a string as reserved as "or" is, is explicitly made a literal.

Craig

Post Reply

Return to “Talking LiveCode”