![](templates/Classic/images/spacer.gif) |
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Tue Jun 15, 2010 4:46 am
[3.19d-] BUG?: @var.key expansion |
In the case of the following code, should @food.cheese return the string value "%int(@calories * 0.33)" or the integer value '333'? In 3.17, I had always expected the results to be an integer value; Though recent testing makes me wonder if that was a bug.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<class name="Test" copy="yes">
<var name="calories" copy="yes">1000</var>
<alias name="test" copy="yes">
<value>#print @food.cherry_pie
#print @food.cheese</value>
</alias>
<var name="food" type="Record" copy="yes">
<value>cheese=%int(@calories * 0.33)|dessert=1|cherry_pie=%int(@calories*3/4)|utensil=fork|entrees=one,two</value>
<json>{"dessert":1,"cherry_pie":"%int(@calories*3\/4)","utensil":"fork","entrees":"one,two","cheese":"%int(@calories * 0.33)"}</json>
</var>
</class>
</cmud> |
|
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jun 15, 2010 5:02 pm |
It should return a String value, not a number. Variable expansion in CMUD (unlike zMUD) is not recursive. So the function should not getting evaluated unless you use %eval on the result.
My guess is that the code which handles user-defined functions was messed up with the previous string list and database variables and might have been treating a string value as a user-defined function, which isn't allowed within a string list or database variable.
However, your report *does* indicate a problem/bug with the import of json XML. When I import your above variable, the underlying json table isn't correct, so I've added that to the bug list. |
|
|
![](templates/Classic/images/spacer.gif) |
|
|
|
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
|
|