|
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Thu Jun 17, 2010 5:23 am
[3.19f] BUG: #add wonkiness |
I'm sure there's a better description than wonkiness, but #add doesn't work in the following script.
Code: |
#unvar testvar
#5 {
#add testvar 10
#print {Testvar: @testvar}
} |
output:
Quote: |
Testvar: 10
Testvar: 1010
Testvar: 101010
Testvar: 10101010
Testvar: 1010101010 |
|
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Thu Jun 17, 2010 5:47 am |
The reason seems to be that when you don't have a variable, it creates it as a string by default. Therefore, it sees 10 as a string instead of an integer, and 'appropriately' adds (concatenates, actually) the new value.
If you do:
Code: |
testvar=0
#5 {#ADD testvar 10;#PRINT {Testvar: @testvar}} |
it properly returns:
Code: |
Testvar: 10
Testvar: 20
Testvar: 30
Testvar: 40
Testvar: 50 |
Charneus |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jun 17, 2010 4:34 pm |
Yeah, but the bug is valid. When a variable doesn't exist, it is actually supposed to default to Auto type, and when it is first used it should see the 10 and use the numeric version. So something has happened to the Autotype code. Added to bug list.
|
|
|
|
|
|