how to get the value of a custom property if the name of the cProperty is in a variable?

Mark Waddingham mark at
Tue Aug 8 12:00:44 EDT 2017

On 2017-08-08 17:49, hh via use-livecode wrote:
> From a viewpoint of the "get property /set property" syntax
> "unexpected results" sounds convincing here, but, TMHO, it is
> exactly what I would expect from a **viewpoint of array syntax**.
> on mouseUp
>   local catness
>   put "minimal" into catness
>   --> Then the next two lines
>   set the minimal of me to "very much"    --(1)
>   set the "minimal" of me to "very much"  --(2)
>   --> are equivalent and create the same key "minimal".
>   --> As catness is "minimal" and is NOT empty, this is also equivalent 
> to
>   set the catness of me to "very much"    --(3)
>   --> what is, as usual when quoting, equivalent to
>   set the "catness" of me to "very much"  --(4)
>   --> Four equivalent commands (1)-(4) result in the same key 
> "minimal".
>   --> And it["catness"] is empty, correctly.
>   get the customProperties of me
>   put it["catness"] &"/"& it[catness] &"/"& it["minimal"] &"/"& 
> it[minimal]
>   put cr & the keys of it after msg
> end mouseUp

Perhaps I'm misunderstanding your point here, but I think array syntax 
actually helps justify why the current behavior is wrong. Compare:

put 100 into redvalue
put 0 into myArray[redvalue]
put 255 into myArray["redvalue"]


put 100 into redvalue
set the redvalue of me to 0
set the "redvalue" of me to 255

In the first case you get an array { 100: 0, redvalue: 255 }.

In the second case the customprops array is { 100: 255 }.

Basically everywhere else quoted literals evaluate to the quoted value - 
unquoted literals might evaluate to the contents of a variable if that 
variable has been created. In this case (in 'the ... of ...'), though, 
the quoted literal gets treated as if it doesn't have quotes all the 

Warmest Regards,


Mark Waddingham ~ mark at ~
LiveCode: Everyone can create apps

More information about the Use-livecode mailing list