Add Invocation stack - convenience RAS

This commit is contained in:
BlockChainDev 2019-03-15 22:33:32 +00:00
parent 1ff0caf40e
commit f954e6f2ca
3 changed files with 65 additions and 2 deletions

View file

@ -119,3 +119,15 @@ func (ras *RandomAccess) Peek(n uint16) (Item, error) {
return ras.vals[index], nil
}
// Convenience Functions
// PopInt will remove the last stack item that was added
// And cast it to an integer
func (ras *RandomAccess) PopInt() (*Int, error) {
item, err := ras.Pop()
if err != nil {
return nil, err
}
return item.Integer()
}