Page 1 of 1

Where is the comma missing?

Posted: Wed Dec 26, 2012 3:49 am
by cascadesjohn
I'm trying to take the numerical contents I've typed into "Entry Field" and store it in a holding variable I'm calling 'tHold1' using the line below:

Code: Select all

put contents of field "Entry Field" into tHold1
I'm being told I have a "compilation error at line 2" (the line in question, above) and the error message goes on to say "Command: missing ',' near "into", char 26"

This is only my first couple of days into LiveCode but it doesn't seem there should be a need for a comma in that line.

Help appreciated.

Re: Where is the comma missing?

Posted: Wed Dec 26, 2012 4:02 am
by cascadesjohn
Not thinking that it would make any difference, I inserted "the" before "contents." The error went away!

I'm still confused by the error message, though :?: , so any insights are welcome.

Re: Where is the comma missing?

Posted: Wed Dec 26, 2012 4:07 am
by sturgis
Don't think contents is part of the language. If you put the word "the" in front of it, lc thinks its a property.

you can "put the text of field "fieldname" into variablename

or just "put field "fieldname" into variablename

Re: Where is the comma missing?

Posted: Wed Dec 26, 2012 5:56 am
by dunbarx
Hi.

What Sturgis said: "contents" is not in the language. It is very easy to assume that LiveCode speaks English. It does not, and it confuses new users that way.

And something else Sturgis said that bears looking into. When you put that "the" in front of a word that is NOT in the language, LiveCode assumes you are creating a custom property, in your case, named "contents", that will hold (or as you wrote it, already held) some kind of data. This is a powerful tool, and you really should experiment with it. But there was no such property set up beforehand, and though no error was thrown, nothing useful came out of it.

So do play with this marvelous program, and write back often. Read the dictionary, do the lessons and tutorials. Most importantly, make stacks of any and all kinds. an address book, a calculator, a metric converter, anything. There is no substitute for practice, and the simplest tasks will cause you enormous pain and frustration, as well as enormous satisfaction and triumph.

Craig Newman

Re: Where is the comma missing?

Posted: Wed Dec 26, 2012 6:02 am
by cascadesjohn
Thanks to you both.

I took "the contents" out and just commanded put field in variable and things worked.

I appreciate the encouragement. It's English-like, as they claimed, but it's also not. That's my challenge, for sure. (I was an English literature major in college decades ago, but that background is not coming rushing to my aid right now.)

Still don't get the reference to the missing comma in the error message, though.

Hanging in....

John

Re: Where is the comma missing?

Posted: Wed Dec 26, 2012 4:44 pm
by sturgis
I've actually hit the same exact message a couple times lately. In my case, I had copy and pasted a handler from somewhere else and it seems some artifact got "transported" along in the paste.
Needless to say the message wasn't real informative! But at least I knew there was something wrong. (Ended up retyping the thing by hand and it worked. Still not sure exactly WHAT came along with the paste.