What should happen with eval("0")?
When I type it into the chat window, the output is 0.
But when I pull a list of values from a table, and separate them with listGet, and the result of a particular entry is 0, I get "Illegal argument type java.math.BigDecimal, expecting java.lang.String" I have confirmed that what's being passed to eval is "0".
Not a huge deal, I can work around it with an if, though if I want another fixed value (say, 10), I have to use 1d1+9. It'd be nice to figure this out.
This is 1.4.0.5. Haven't tested it with any other version.
Question on eval
Moderators: dorpond, trevor, Azhrei
Forum rules
Posting now open to all registered forum users.
Posting now open to all registered forum users.
Re: Question on eval
Hmm. If I do any of these in the chat window it works fine.
They all return the expected result.
Code: Select all
[isNumber(eval("0"))]
[equals(eval("0"),1)]
[math.asin(eval("0"))]
[eval("0")+2]
Re: Question on eval
There is some type casting when pulling from the list where a number it typed as a number and not a string. eval() only works on strings.
So, try eval(string(listGet(list,0)))
So, try eval(string(listGet(list,0)))
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Question on eval
That makes sense. And fixed it. Thanks.