summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--starling/node.scm15
1 files changed, 15 insertions, 0 deletions
diff --git a/starling/node.scm b/starling/node.scm
index 6461f58..14e4e17 100644
--- a/starling/node.scm
+++ b/starling/node.scm
@@ -22,6 +22,7 @@
(define-module (starling node)
#:use-module (chickadee scripting)
+ #:use-module (ice-9 format)
#:use-module (oop goops)
#:use-module (starling asset)
#:use-module (starling config)
@@ -178,6 +179,20 @@
<developer-meta-node>
<meta-node>))
+(define-method (write (node <node>) port)
+ (define (strip-angle-brackets str)
+ (let ((start (if (string-prefix? "<" str) 1 0))
+ (end (if (string-suffix? ">" str)
+ (- (string-length str) 1)
+ (string-length str))))
+ (substring str start end)))
+ (format port "#<~a name: ~a id: ~d>"
+ (strip-angle-brackets
+ (symbol->string
+ (class-name (class-of node))))
+ (name node)
+ (id node)))
+
(define-method (initialize (node <node>) initargs)
(next-method)
;; Add node to global index.