use-livecode Digest, Vol 217, Issue 30

Neville Smythe neville.smythe at optusnet.com.au
Tue Oct 26 19:51:06 EDT 2021



> On 27 Oct 2021, at 3:00 am,Craig wrote:
> 
> An array variable is just a variable, it is not a property. You cannot ?make? one into the other.
> 
> So, basically, put the pArrayName[pElementName]  of button ?button? is just syntax that does not exist in the lexicon, for the above reason.

Thanks Craig. I was thinking in terms of a natural language, not strict lexical syntax.

Because I would have thought strictly speaking  

put the dropShadow[color] of control X

shouldn't work, there must be an extension of the language  to interpret is as

put (the dropShadow of control X) into foo; put foo[color].

But that extension won’t work with a variable in place of the literal property name, or for a literal which is not a reserved word, because the parser has to check for literal reserved words before it evaluates variables.  Which also explains why the apparently similar

put the foo[bar] of control X

returns empty even though the control has a custom property foo with key bar having a non-empty value. 

Speaking of  reserved words here is an oddity

put rect[1]

returns “]" (strange, but true, and apparently happens for any reserved word value of rect)

Of course

put “rect” into foo; put foo[1]

returns empty, because as above reserved words are interpreted before variable evaluation, not after. It all makes sense now - well, except for rect[1]




More information about the use-livecode mailing list