Multidimensional array issue

Tom Glod tom at makeshyft.com
Wed Mar 10 22:52:38 EST 2021


 >>>>>> (tArray["key1","key1.1"]["key2","key2.1"])

Sean....  never even thought about this form of arrays.  I gotta test the
functionality of this.  Thanks.
I know you are busy, but if you have the time, feel free to blow my mind.






On Wed, Mar 10, 2021 at 8:12 PM Sean Cole (Pi) via use-livecode <
use-livecode at lists.runrev.com> wrote:

> In the message box:
>
>
>
> > put "data" into tArray["key1"]["key2"]; answer the value of
> tArray["key1”]
> > - returns EMPTY (so this works)
>
> Correct
>
> put "data" into tArray["key1"]["key2"]; answer tArray["key1”] is empty -
> > returns FALSE (it should return true IMHO)
>
> Because it is not empty. It has a nested array in it. If it where empty
> (TRUE) then it would be void of all data of all types.
>
> put "data" into tArray["key1"]["key2"]; answer tArray["key1”] is an array -
> > returns TRUE (so not helpful)
>
> tArray is an array;
> tArray["key1"] is an array (because it has ["key2"] within;
> tArray["key1"]["key2"] is not an array (unless you put an array into it)
>
> To make this clearer:
>
> put "hello" into tArray    -- tArray is not an array
>
> put tArray; // returns "hello"
>
> tArray contains a value = true
>
> tArray is empty = false  --  it contains a value
> tArray["key1"] is empty = true  --  it does not exist
> tArray["key1"]["key2"] is empty = true  --  it does not exist
>
>
> put "hello" into tArray["key1"]    -- tArray is an array ; tArray["key1"]
> is not an array
>
> put tArray; // returns empty
>
> put tArray["key1"]; // returns "hello"
>
> tArray contains a value = false
> tArray["key1"] contains a value = true
> tArray is empty = false  --  it contains an array
> tArray["key1"] is empty = false  --  it contains a value
>
> tArray["key1"]["key2"] is empty = true  --  it does not exist
>
>
> put "hello" into tArray["key1"]["key2"]    -- ttArray is an array
> ; tArray["key1"] is an array ; tArray["key1"]["key2"] is not an array
>
> put tArray; // returns empty
>
> put tArray["key1"]; // returns empty
> put tArray["key1"]["key2"]; // returns "hello"
>
> tArray contains a value = false
> tArray["key1"] contains a value = false
> tArray["key1"]["key2"] contains a value = true
> tArray is empty = false  --  it contains an array
> tArray["key1"] is empty = false  --  it contains an array
> tArray["key1"]["key2"] is empty = false  --  it contains a value
>
> put "hello" into tArray    -- tArray is not an array; it has been reset to
> a value nullifying it's array status and values
>
> put tArray; // returns "hello"
>
> tArray contains a value = true
>
> tArray is empty = false  --  it contains a value
> tArray["key1"] is empty = true  --  it does not exist
> tArray["key1"]["key2"] is empty = true  --  it does not exist
>
> put "hello" into tArray
> put "hello" into tArray["key2"]
> put tArray into tArray["key1"]
> tArray =
>
> ["key1"] > ["key2"] > "hello"
> ["key2"] > "hello"
>
> That just about covers it. Unless I go into super sub arrays to really blow
> your mind (tArray["key1","key1.1"]["key2","key2.1"])
>
> Sean
> _______________________________________________
> 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
>


-- 
Tom Glod
Founder & Developer
MakeShyft R.D.A (www.makeshyft.com)
Mobile:647.562.9411



More information about the use-livecode mailing list