long id trap for the unwary

Neville Smythe neville.smythe at optusnet.com.au
Mon Jun 27 23:27:04 EDT 2022


If I write

     put the long id of field 1 of card 1 into tObject; put the text of tObject

I get the text of field 1 of card 1, right ? Not necessarily.

If field 1 of card 1 is in a shared group, then what I get is the text of field id something of card id whatever, where whatever is the id of the current card or maybe the first card containing the group. 

This is not actually a bug when you read the docs carefully but it certainly is a trap and in my case a major bug generator. It means this seemingly obvious way of obtaining the long id of an object (rather, in this case an instance of an object)  cannot be used to uniquely identify it when getting its properties.

The workaround is to replace card id (whatever) with card id (the id of card 1) in tObject;  the properties of tObject returned are then the properties of the expected instance of the object.

Sigh, a new version of nsScriptDatabase coming up.

Neville







More information about the use-livecode mailing list