Invisible syntax error?

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

Invisible syntax error?

Post by dunbarx » Mon Aug 06, 2018 3:32 pm

I was playing with the "difference" command for arrays, and simply pasted this example from the dictionary into a button script:

Code: Select all

on mouseUp
 put "green" into tLeft["color"]
   put "left" into tLeft["align"]
   
   put "blue" into tRight["color"]
   put "100" into tRight["width"]
   
  difference tLeft with tRight
end mouseUp
It will not compile. The last line throws an error:
button "Button": compilation error at line 8 (Commands: missing ',') near "with", char 14
Now the error sort of tells me I need a comma instead of the keyword "with", as in:

Code: Select all

difference tLeft, tRight
But this is an entirely different construction, as if there ought to be a handler named "difference" somewhere.

The original code seems solid. Any ideas?

Craig Newman

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Invisible syntax error?

Post by Klaus » Mon Aug 06, 2018 3:55 pm

Hi Craig,

I copied your script, pasted it here into a fresh button and could compile and execute without errors. Result as exspected and described in the dictionary. Check for invisible and unwanted characters in the code.

macOS 10.13.6, LC 9

P.S.
"difference" was introduced in LC 9 according to the docs, so if you are using LC 8.x...


Best

Klaus

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

Re: Invisible syntax error?

Post by dunbarx » Mon Aug 06, 2018 6:12 pm

AHA.

I was using Brian Milby's fast and easy on-line dictionary. In the embedded v.8 dictionary, there is no mention of the command at all.

So the error was essentially correct. LC was expecting a command call, and suggested I get rid of the unknown "with" and put in a comma like a good boy.

It might be a lesson to others to watch out which version of Brian's dictionary one is using, if indeed he even offers earlier versions.

Brian, do you only offer the latest and greatest?

Craig

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3975
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Invisible syntax error?

Post by bn » Mon Aug 06, 2018 7:59 pm

Hi Craig,

if you use

http://livecodeshare.runrev.com/stack/8 ... Dictionary

as a plugin then you have for each version of Livecode starting with 8.1 the current dictionary of that version. I.e. if you have both LC 8.1 open and 9.0 open and you open TinyDictionary in each of those you will have the dictionary for that version in TinyDict.

Disclaimer: I know the guy who wrote this thing.

Kind regards
Bernd

bwmilby
Posts: 438
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Invisible syntax error?

Post by bwmilby » Mon Aug 06, 2018 10:23 pm

Yes, the one that I'm hosting is just for the latest build.
But, you can easily build your own copy. Source stack is here:
https://github.com/bwmilby/lc-misc/tree ... ebDocMaker

The following is included on all dictionary entries:
Introduced 9.0
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Invisible syntax error?

Post by bogs » Mon Aug 06, 2018 11:30 pm

I just have to say I REALLY love TinyDictionary!
Image

Post Reply

Return to “Talking LiveCode”