Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
List Inspector 1.1 with Tree View
Moving tool tip
Attrib Xtra
GetInfoFromAIFF
Director MX Bugs: editable text and on prepareFrame
MP3 Player
EndFramesScript
Buddy API Review
Elliptical Sprite Behavior
Windows for Shockwave 4.5
 

 

 

Behavior Implementing stacks in Lingo

Added on 7/2/1999

 

Compatibilities:
D6_5 D7 D8 Mac PC Script

This item has not yet been rated

Author: Penworks (website)

Reproduced with permission from Penworks Lingo User"s Journal

-- Source Code from the Lingo User"s Journal
-- Copyright (c) 1995 by Penworks Corporation

on initStacks
  global stackList
  set stackList =[:]
end initStacks


on push whichStack, whatItem
  global stackList

  set whichList =getaProp(stackList, whichStack)
  if (voidP(whichList)) then
    set whichList =[]
    addProp(stackList, whichStack, whichList)
  end if
  append(whichList, whatItem)
end push


on pop whichStack
  global stackList

  set whichList =getaProp(stackList, whichStack)
  if (voidP(whichList)) then
    alert "Attempt to pop from non-existent stack: #"&whichStack
    return 0
  end if
  set stackSize =count(whichList)
  if not stackSize then
    alert "Attempt to pop from empty stack: #"&whichStack
    return 0
  end if

  -- Now get the item, then delete it
  set thisItem =getLast(whichList)
  deleteAt(whichList, stackSize)

  return(thisItem)
end pop


on closeStacks
  global stackList
  set stackList =[:]
end closeStacks

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail