UNIQUE CARD IDs

Bob Sneidar bobs at twft.com
Thu Aug 4 15:31:55 EDT 2011


Because if the engine did not make sure of it, things would get really, really hosed in your stack in a hurry. The engine relies on the fact that every object has it's own unique id, and so does not leave it up to us. Someone in a past thread was trying to set the id of the stack so that he could control what the next id of an object was. This turned out to be sketchy, one of the reasons being, the IDE would not allow him to set the ID to something lower than it already was. 

The engine is designed to prevent ID conflicts from happening, otherwise we would all be in a funny farm right now. You could just as easily ask, "How can I be sure that when I create a new button it will actually be created?" At some point you just have to trust that it is so. Clone Card and New Card increment the ID of the stack, look at the ID of the stack, then set the new object to that. In fact, any time you create ANYTHING it works like this. The stack ID is the next object counter and so should never be used as a reference or manipulated in any way, and though you can increment it yourself, I would discourage it. 

Bob


On Aug 4, 2011, at 11:51 AM, Joe Lewis Wilkins wrote:

> Hi Jaqui,
> 
> When new cards are created with the clone command, how sure can we be that the new card will be given a unique ID for the current stack?
> 
> TIA,
> 
> Joe Lewis Wilkins
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> 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





More information about the Use-livecode mailing list