String returns the Top Of Stack if it is a string or panics.
(f Forth)
| 248 | // String returns the Top Of Stack if it is a string |
| 249 | // or panics. |
| 250 | func String(f Forth) string { |
| 251 | c := f.Pop() |
| 252 | switch s := c.(type) { |
| 253 | case string: |
| 254 | return s |
| 255 | default: |
| 256 | panic(fmt.Sprintf("Can't convert %v to a string", c)) |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | // toInt converts to int64. |
| 261 | func toInt(f Forth) int64 { |