You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
496 B

--[[
Stack.lua
@Author : DengSir (tdaddon@163.com)
@Link : https://dengsir.github.io
]]
local ns = select(2, ...)
local Addon = ns.Addon
local Stack = Addon:NewClass('Stack') ns.Stack = Stack
function Stack:Constructor()
self.stack = {}
end
function Stack:Push(item)
if item ~= nil then
tinsert(self.stack, 1, item)
end
end
function Stack:Pop()
return table.remove(self.stack, 1)
end
function Stack:Top()
return self.stack[1]
end