Skip to content

Instantly share code, notes, and snippets.

@onionhammer
Created October 20, 2013 17:34
Show Gist options
  • Save onionhammer/7072696 to your computer and use it in GitHub Desktop.
Save onionhammer/7072696 to your computer and use it in GitHub Desktop.
Error: for a 'var' type a variable needs to be passed
type
TSettingKind* = enum
SettingInt, SettingString, SettingChannel, SettingBool
TSettings = seq[TSetting]
TSetting* = object
name*: string
var settings: TTable[string, TSettings]
var newSetting = TSetting(kind: kind)
#Check if key already exists
if settings.hasKey(key):
settings[key].add(newSetting) #Doesn't work
#Works
var existing = settings[key]
existing.add(newSetting)
else:
settings[key] = @[newSetting]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment