Page 1 of 1

Invisible syntax error?

Posted: Mon Aug 06, 2018 3:32 pm
by dunbarx
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

Re: Invisible syntax error?

Posted: Mon Aug 06, 2018 3:55 pm
by Klaus
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

Re: Invisible syntax error?

Posted: Mon Aug 06, 2018 6:12 pm
by dunbarx
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

Re: Invisible syntax error?

Posted: Mon Aug 06, 2018 7:59 pm
by bn
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

Re: Invisible syntax error?

Posted: Mon Aug 06, 2018 10:23 pm
by bwmilby
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

Re: Invisible syntax error?

Posted: Mon Aug 06, 2018 11:30 pm
by bogs
I just have to say I REALLY love TinyDictionary!