andy@gistdev.gist.com (Andy Warinner) (05/03/90)
I have a field that stores the id of a card. Is there any way to check that the id stored actually exists? For example: -- bkgnd field "cardPtr" holds card id if verifyCard(bkgnd field "cardPtr") then go to card id (bkgnd field "cardPtr") else answer "You screw up!" Thanks in advance, Andrew Warinner |"The Berlin Wall is down. That means Germans are free to go GIST, Inc. | wherever they want. Hey, wasn't that the problem in 1939?" Standard | EMAIL: andy@gistdev.gist.com disclaimer... | {uunet, uiucuxc}!gistdev!andy (Rumor has it that the upcoming release of the Caffeine Manager is causing jitters and sleepless nights for the MS Windows development team and IBM upper management.)
man@vali.cs.brown.edu (Mark H. Nodine) (05/04/90)
In article <903@gistdev.gist.com>, andy@gistdev.gist.com (Andy Warinner) writes: |> |>I have a field that stores the id of a card. Is there any way to |>check that the id stored actually exists? For example: |> |> -- bkgnd field "cardPtr" holds card id |> if verifyCard(bkgnd field "cardPtr") |> then go to card id (bkgnd field "cardPtr") |> else answer "You screw up!" How about function verifyCard theID put the short id of this card into cardID push this card go card id theID put (the short id of this card is not cardID) into answer pop card return answer end verifyCard I just made this up on the spot, but I know the technique works, since I've used it before. In other words, the code may be flawed, but the technique is OK. --Mark
jdevoto@Apple.COM (Jeanne A. E. DeVoto) (05/05/90)
In article <903@gistdev.gist.com> andy@gistdev.gist.com (Andy Warinner) writes: >I have a field that stores the id of a card. Is there any way to >check that the id stored actually exists? For example: > > -- bkgnd field "cardPtr" holds card id > if verifyCard(bkgnd field "cardPtr") > then go to card id (bkgnd field "cardPtr") > else answer "You screw up!" If you try to go to a non-existent card from a script, the result function will return a non-empty value. The following will do the check: go card ID XXX if the result is not empty then -- do failure procedure else -- do success procedure -- if you just wanted to check for existence, not go to the card, -- you can put a "go recent card" in here to get back to where you -- were. end if -- ========= jeanne a. e. devoto ======================================== jdevoto@apple.com | You may not distribute this article under a jdevoto@well.sf.ca.us | compilation copyright without my permission. ______________________________________________________________________ Apple Computer and I are not authorized | CI$: 72411,165 to speak for each other. | AppleLink: SQA.TEST