|
function push(table, value)
|
|
table[#table + 1] = value
|
|
end
|
|
|
|
function pop(table)
|
|
if #table > 0 then
|
|
local value = table[#table]
|
|
table[#table] = nil
|
|
return value
|
|
else
|
|
return nil
|
|
end
|
|
end
|
|
|
|
function peek(table)
|
|
return #table == 0 and nil or table[#table]
|
|
end |