aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.lisp')
-rw-r--r--src/utils.lisp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils.lisp b/src/utils.lisp
index e0f6dcd..3598ec3 100644
--- a/src/utils.lisp
+++ b/src/utils.lisp
@@ -7,3 +7,10 @@
(defun radians (degrees)
"Converse DEGREES to radians"
(* degrees +pi-over-180+))
+
+(defun safe-slot (object slot &optional default)
+ (if-let (val (and (slot-exists-p object slot)
+ (slot-boundp object slot)
+ (slot-value object slot)))
+ val
+ default))