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

J. Landman Gay jacque at hyperactivesw.com
Tue Aug 8 11:25:48 EDT 2017


The answer to the first case is "don't do that". Use a different variable 
name for the local.

The second case is interesting. I wouldn't mind having multiple-word 
property names.

--
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



On August 8, 2017 10:17:29 AM Mark Waddingham via use-livecode 
<use-livecode at lists.runrev.com> wrote:

> On 2017-08-08 17:09, J. Landman Gay via use-livecode wrote:
>> In what circumstance would it be necessary to quote the property name?
>
> The original case Dr Hawkins encountered was something along the lines
> of:
>
> local someVar
> put 100 into someVar
> put the someVar of me
>
> Here, this will fetch the custom property '100'. Ideally you'd be able
> to do
>
>    put the "someVar" of me
>
> Instead - the quoting indicating you want to use that *literal* value
> for the
> property name, instead of the variables context.
>
> Another case is wanting to fetch custom property names which contain
> chars you
> can't have in an unquoted literal:
>
>    put the "my property name with lots of words (and parantheses) too" of
> me
>
> Currently, using quoted literals in this case works for setting, but
> doesn't
> work for getting; and even a quoted literal will still resolve to a
> variable
> if one has been defined.
>
> I think the latter is probably something which is unlikely to hurt
> anyone if
> tweaked though...
>
> Warmest Regards,
>
> Mark.
>
>>
>> On August 8, 2017 6:05:21 AM Mark Waddingham via use-livecode
>> <use-livecode at lists.runrev.com> wrote:
>>
>>> 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.
>>
>> --
>> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
>> HyperActive Software           |     http://www.hyperactivesw.com
>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> --
> Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode






More information about the use-livecode mailing list