Skip to content

Instantly share code, notes, and snippets.

@nefftd
Created July 16, 2014 03:17
Show Gist options
  • Save nefftd/c07efbfda6b427ad1758 to your computer and use it in GitHub Desktop.
Save nefftd/c07efbfda6b427ad1758 to your computer and use it in GitHub Desktop.
local MAXSIZE = 100
local stack = {}
local function stack_push(val)
if #stack > MAXSIZE then
table.remove(stack,1)
end
stack[#stack+1] = val
end
local function stack_pop()
return table.remove(stack) -- removes and returns the last item
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment