This provides a simple chat window calculator.
This program responds to requests in Whispers, Party, Raid, and Guild chat messages starting with a # symbol. It evaluates them as a math function and provides the result. It is very simple to use:
To [Amberton]: #8*8
[Amberton] whispers: 8*8 = 64
To [Amberton]: #1-(1-.01)^30
[Amberton] whispers: 1-(1-.01)^30 = 0.26029962661172
It also allows other players to request calculations.
Note that this addon does produce a lambda function from the text, but also uses setfenv() to limit the functions that can be used to those related to math (sin, cos, sqrt, log, factorial, etc...), and the word "function" anywhere in the equation will fail (to prevent someone writing you into an infinite loop). If you don't trust these protections don't install the addon. If you find a vulnerability in this, please contact me at [email protected] so i can fix it.