 |
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Wed Jun 16, 2010 3:10 am
[3.19e] BUG: Default values being treated as strings. |
Using "key=int" as the default value for a database variable will cause cmud to treat the integer as a string value. You can see this in the json value for the variable.
code:
| Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<alias name="test" copy="yes">
<value>#addkey testvar cheese 0
#var testvar
#reset testvar
#var testvar
#reset testvar
#var testvar</value>
</alias>
<var name="testvar" type="Record" usedef="true" copy="yes">
<value>cheese=0</value>
<json>{"cheese":"0"}</json>
<default>cheese=3</default>
</var>
</cmud> |
output:
| Quote: |
Testvar:
Variable: + testvar (Record) cheese=0
json: {"cheese":0} (object)
Variable: + testvar (Record) cheese=3
json: {"cheese":"3"} (object)
Variable: + testvar (Record) cheese=3
json: {"cheese":"3"} (object) |
The reason I put two #resets in there is because if you open up the package editor, change the value, and run the test alias again, you'll get this:
| Quote: |
Testvar:
Variable: + testvar (Record) cheese=0
json: {"cheese":0} (object)
Variable: + testvar (Record) cheese=0
json: {"cheese":0} (object)
Variable: + testvar (Record) cheese=3
json: {"cheese":"3"} (object) |
Notice that it did not reset on the first attempt. |
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jun 16, 2010 4:25 pm |
Yep, confirmed and added to bug list. That's also odd about the reset.
|
|
|
|
 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|