Created
October 20, 2013 17:34
-
-
Save onionhammer/7072696 to your computer and use it in GitHub Desktop.
Error: for a 'var' type a variable needs to be passed
This file contains hidden or 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
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