-
-
Save exts/eb81ea1d04a964742a85813944e1b602 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc get[T](settings: SettingsTable, key: string): T = | |
if settings.hasKey(key): | |
let val = settings[key] | |
if (T is string) and val.kind == sString: | |
return cast[T](val.strVal) | |
elif (T is seq[string]) and val.kind == sSeqString: | |
return cast[T](val.seqVal) | |
raise newException(IndexError, "Invalid Settings Key") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment