how to refer to a custom prop that is a multidimensional array

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

how to refer to a custom prop that is a multidimensional array

Matthias Rebbe via use-livecode
My stack has a custom prop "cKweto" which has various elements. For now,
elements (arrays?) are single. But next I want to add multidimensional
elements (arrays?). The proble is I do not how to refer to those
multidimendional elements, say within a button script.

For single elements, no problem. E.g., a value (360) is returned when my
script has:

put the cKweto["height_landscape_default"] of this stack

But when I try ...
put the cKweto["landscape","height"] of this stack
... or
put the cKweto["landscape"]["height"] of this stack
.. no values are retrieved, even though I can see them in the Property
Inspector.

What should I be doing?

Thank you.

--
Nicolas Cueto
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: how to refer to a custom prop that is a multidimensional array

Matthias Rebbe via use-livecode
put the cKweto["landscape"] of this stack into sLandscape
put sLandscape["height"] into ...

I don't think you can retrieve array elements like you were trying to do.
If I'm wrong, someone more versed will surely correct me soon enough though
:)

Thanks,
Brian

On Mon, Jan 22, 2018 at 11:36 PM Nicolas Cueto via use-livecode <
[hidden email]> wrote:

> My stack has a custom prop "cKweto" which has various elements. For now,
> elements (arrays?) are single. But next I want to add multidimensional
> elements (arrays?). The proble is I do not how to refer to those
> multidimendional elements, say within a button script.
>
> For single elements, no problem. E.g., a value (360) is returned when my
> script has:
>
> put the cKweto["height_landscape_default"] of this stack
>
> But when I try ...
> put the cKweto["landscape","height"] of this stack
> ... or
> put the cKweto["landscape"]["height"] of this stack
> .. no values are retrieved, even though I can see them in the Property
> Inspector.
>
> What should I be doing?
>
> Thank you.
>
> --
> Nicolas Cueto
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: how to refer to a custom prop that is a multidimensional array

Matthias Rebbe via use-livecode
In reply to this post by Matthias Rebbe via use-livecode
> N.C. wrote:
> What should I be doing?

There is a good tutorial
Step-By-Step Guides To Tasks In LiveCode - Custom Properties

http://lessons.livecode.com/m/4071/c/16763

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: how to refer to a custom prop that is a multidimensional array

Matthias Rebbe via use-livecode
Hi.

I am not sure I understand your question. What is different about this:

on mouseUp
   put 6 into myArray["x"]["a"]
   put 7 into myArray["x"]["b"]
   put 8 into myArray["x"]["c"]
   
   answer myArray["x"][any char of "abc"]
end mouseUp

Craig Newman



--
Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: how to refer to a custom prop that is a multidimensional array

Matthias Rebbe via use-livecode
In reply to this post by Matthias Rebbe via use-livecode
Oh.  Now I see. You want to retrieve "interior" elements of an array directly
from a single call to a custom property. As said, I think you have to
retrieve the property, and then retrieve the element. Two lines of code.

Craig



--
Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: how to refer to a custom prop that is a multidimensional array

Matthias Rebbe via use-livecode
Thanks, Brian and Craig.

Two lines of code? Then, I'll skip using multidimensional custom props.

--
Nicolas Cueto

On 23 January 2018 at 23:02, dunbarx via use-livecode <
[hidden email]> wrote:

> Oh.  Now I see. You want to retrieve "interior" elements of an array
> directly
> from a single call to a custom property. As said, I think you have to
> retrieve the property, and then retrieve the element. Two lines of code.
>
> Craig
>
>
>
> --
> Sent from: http://runtime-revolution.278305.n4.nabble.com/
> Revolution-User-f278306.html
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode