mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
26 lines
486 B
Plaintext
26 lines
486 B
Plaintext
/datum/stack
|
|
var/list/contents = list()
|
|
|
|
/datum/stack/proc/Push(value)
|
|
contents += value
|
|
|
|
/datum/stack/proc/Pop()
|
|
if(!contents.len)
|
|
return null
|
|
|
|
. = contents[contents.len]
|
|
contents.len--
|
|
|
|
/datum/stack/proc/Top() //returns the item on the top of the stack without removing it
|
|
if(!contents.len)
|
|
return null
|
|
|
|
return contents[contents.len]
|
|
|
|
/datum/stack/proc/Copy()
|
|
var/datum/stack/S = new()
|
|
S.contents = src.contents.Copy()
|
|
return S
|
|
|
|
/datum/stack/proc/Clear()
|
|
contents.Cut() |