Livecode always returns true if you test an array for empty, although I think that behavior might have changed in a recent release. test["data"] is an array since it has the "a1" subkey.
I think this will tell you if test["data"] has any subkeys or not and thus whether it's empty or not: if test["data"] is an array Pete lcSQL Software <http://www.lcsql.com> Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html> On Tue, Jul 1, 2014 at 11:58 AM, William Prothero <proth...@earthednet.org> wrote: > Folks: > LC 6.6.0, OSX 10.9.3 > I have the following script: > > put "XX" into test["data"]["a1"] > if test["data"] is empty then > answer "It is empty" > else > answer "Not empty" > end if > > I would think that if there was some value in test[“data”], it would > return “Not empty”. However, it returns empty. I think this is a very > unexpected behavior because I think of the “a1” value of test as a > subarray, especially since test[“a1”] doesn’t have the set value. In fact, > test[“data”] is not empty. It contains the subarray [“a1”]. > > Is this a bug or just a livecode oddity? > > Thanks, > Bill > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode