The selectedObjects - is it a container or not?
Graham Samuel
livfoss at mac.com
Tue Apr 18 03:46:49 EDT 2017
Jacque, you’re never wrong! I know really that the ‘the’ indicates a function, but at the same time it’s kind of a trap within the idea that LC scripting is “English-like". For clarity, managing the selected objects is probably better done by something like:
put selectedObjects() into temp
then do stuff with ‘temp’, which of course **is** a container.
Anyway thanks
Graham
> On 18 Apr 2017, at 01:39, J. Landman Gay via use-livecode <use-livecode at lists.runrev.com> wrote:
>
>> I have a bit of code that says in part:
>>
>> if the selectedObjects is not empty then
>> repeat with i = 1 to the number of lines of the selectedObjects
>> …
>>
>> This results in an error “source is not a container”.
>>
>> OTOH, if I change the second line to
>>
>> repeat with i = 1 to the number of lines of (the selectedObjects0
>>
>> the code works as expected.
>
>
> The selectedObjects is a function that returns a text list. It isn't a container. Adding parentheses forces the engine to evaluate the function and use its return value, which does have lines in it.
>
> --
> Jacqueline Landman Gay | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
>
More information about the use-livecode
mailing list