how to get the value of a custom property if the name of the cProperty is in a variable?
Mark Waddingham
mark at livecode.com
Tue Aug 8 07:03:25 EDT 2017
On 2017-08-08 12:43, hh via use-livecode wrote:
> Two examples for testing ambiguity.
>
> [a]
> set "8.1" of me to "I dreamt to be quoted"
> set 8.1 of me to "I dreamt to be 8.2"
> put the customProperties of me into cp
> put cp["8.1"] &" : "& cp[8.1] &" : "& cp[8+1/10]
> Test and then interchange the first two lines and test again.
>
> [b]
> set "G&T" of me to "I dreamt to be geometry and trigonometry"
> put the customProperties of me into cp
> put cp["G&T"]
So this does work as 'expected' currently. i.e. You can use a quoted or
unquoted literal for a custom property name, and it will use the literal
appropriately.
What doesn't work at the moment is if you have a var name which is
quoted:
local catness
put "minimal" into catness
set the "catness" of me to "very much"
get the customProperties of me
put the keys of it
Will result in a key 'minimal' and *not* 'catness' - which is perhaps
not what would be expected.
Warmest Regards,
Mark.
--
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode
mailing list