### javascript list handling bug

Posted:

**Wed Feb 06, 2013 5:09 pm**dicenomicon 3.1.1 on iPad, iOS 5.1.1

I'm not sure exactly what is happening, but it looks like if a list is the only argument passed to a function in javascript, the first element of the list is the value which arrives, not the list itself.

Code: Select all

```
<function id="LISTTOSTRING" language="javascript">
function LISTTOSTRING(arrDieTypes) {
'use strict';
return typeof arrDieTypes;
}
</function>
<formula>
@TYPES <- (4,6).
@ROLLED <- (2,6).
length(@ROLLED) + @LISTTOSTRING(@ROLLED, @TYPES)
</formula>
// returns '2 object' - ie @ROLLED is a list, and a list as far as Dicenomicon is concerned.
<formula>
@TYPES <- (4,6).
@ROLLED <- (2,6).
length(@ROLLED) + @LISTTOSTRING(@ROLLED)
</formula>
// returns '2 number' - ie @ROLLED is a number as far as javascript is concerned, and a list as far as Dicenomicon is concerned..
<formula>
@ROLLED <- (2,6).
length(@ROLLED) + @LISTTOSTRING(@ROLLED)
</formula>
// returns '2 number' - ie @ROLLED is a number as far as javascript is concerned, and a list as far as Dicenomicon is concerned..
```