-- Step 1: Create a new stack
local stack = {}
-- Step 2: Push elements onto the stack
table.insert(stack, "Element 1")
table.insert(stack, "Element 2")
table.insert(stack, "Element 3")
-- Step 3: Pop elements from the stack
local poppedElement = table.remove(stack)
-- Step 4: Access the top element without removing it
local topElement = stack[#stack]
-- Step 5: Check if the stack is empty
local isEmpty = #stack == 0
-- Step 6: Print or use the results
print("Popped Element:", poppedElement)
print("Top Element:", topElement)
print("Is Stack Empty:", isEmpty)