Add tons of builtin helpers and array operations.
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
package object
|
||||
|
||||
import "os"
|
||||
|
||||
// Exit ...
|
||||
func Exit(args ...Object) Object {
|
||||
var status int
|
||||
if len(args) == 1 {
|
||||
if args[0].Type() != INTEGER_OBJ {
|
||||
return newError("argument to `exit` must be INTEGER, got %s",
|
||||
args[0].Type())
|
||||
}
|
||||
os.Exit(int(args[0].(*Integer).Value))
|
||||
} else {
|
||||
os.Exit(0)
|
||||
status = int(args[0].(*Integer).Value)
|
||||
}
|
||||
|
||||
ExitFunction(status)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user