Skip to content
Chris Petersen edited this page Oct 16, 2014 · 1 revision

settings-ref returns the value of a setting, returning the fallback if no matching key or #f if also no fallback specified.

Parameter Description
key The settings key
fback Optional: The fallback value if no matching key key is found

Example

Example 1: Initialize the settings file and retrieve and store some settings values

;; Make sure we have a config directory
(let ((configdirectory (string-append (system-directory) (system-pathseparator) "config")))
  (if (not (file-exists? configdirectory))
    (create-directory configdirectory)))
;; Initialize the settings file
(settings-init (list (cons "Localization" 1)
                     (cons "SensorLocations" (list "Ear" "Hand" "Foot"))))
;; Retrieve and store some settings values
(display (settings-ref "Localization")) (newline)
(define username "demo")
(if (string? username) (settings-set! "Username" username))
Clone this wiki locally