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