Formula Device Error

In the formula device, you will sometimes get an error that reads:

attempt to call a number value

I was able to figure out that it has to do with user variable names (excuse the example).
The code provided is completely legitimate, and the workaround that I use is to add a +0 to the end like so:

which can then be removed to achieve the originally desired behavior:

I’m not sure if this has something to do with Lua evaluation outside of @taktik 's control, or if the way evaluation is implemented can be changed. But I think you see the problem and it actually comes up for me quite often. I’m not sure if other formula-heads have ran into it but I haven’t heard of it.

This happens when you change the variable name in the formula after you’ve changed it in the code. If you make any change to code after this then it recompiles and works.

formula

2 Likes

Right, I have found this to be the case. I would not consider this a solution, and couldn’t quite tell if that’s how you offered it, or if you were adding info. Thank you in either case though.

I wouldn’t consider this a solution for what I’m experiencing because I believe that one should be able to type out the formula code into the formula box, and when you are done typing, if you have a valid expression, it will be evaluated without error. I think others would agree this is desirable behavior.

However, maybe you’re informing me that this behavior is an inevitable result of having 2 text-boxes for the API to evaluate. In that case, I think that doing as you have demonstrated would be preferable to my “add zero” approach, so yes thank you for that :slight_smile:

Will be fixed in the next update. Thanks!

5 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.