Divergent/mods/Anomaly Magazines Redux/gamedata/scripts/stack.script

17 lines
304 B
Plaintext

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