SettingXML GetString question

Discussion of Inner Space

Moderators: Lavish Software Team, Moderators

Post Reply
none69
GamingTools Subscriber
Posts: 2
Joined: Tue Mar 01, 2005 11:08 am

SettingXML GetString question

Post by none69 » Fri May 27, 2005 8:41 am

when i use the following command:

Code: Select all

echo ${SettingXML[filename].Set[Set].GetString[Test,NotDefined]}
if the Test key does not exits it returns NotDefined but it also writes NotDefined to the xmlfile. Is this the desired functionality?

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Fri May 27, 2005 11:21 am

We were discussing this in IRC, you should join the channel and take part in discussions ;)

Yes, it is usually desired. The default value is not required, and it is not required in order for you to determine if the setting is there:
${SettingXML[filename].Set[Set].GetString[Test](exists)} - TRUE if the setting exists, NULL if it does not

${SettingXML[filename].Set[Set].GetString[Test,"Some Default Value"]}
Sets the default value in the XML file if the setting does not exist, and gives the value.

I can make some changes if you can present an argument for why it is better to have the default NOT stored.

none69
GamingTools Subscriber
Posts: 2
Joined: Tue Mar 01, 2005 11:08 am

Post by none69 » Fri May 27, 2005 12:10 pm

I am good with either. Just did not want to change my code until I knew if it was a "Feature" or not. ;)

Post Reply