Nvm, figured it out by myself, just added http://lua-users.org/wiki/SimpleRound to the function. I updated the https://test2.wikipedia.org/wiki/Module:Molar mass calculator page if you'd like to see my current code (which I have tested btw in my chembox and in my /Template:Molar mass calculator/)
On 2/04/2015 11:07 PM, Brenton Horne wrote:
Oh hey one other thing, how do I get the module to round the result to 3 decimal places?
On 2/04/2015 10:27 AM, Brad Jorsch (Anomie) wrote:
On Wed, Apr 1, 2015 at 3:36 PM, Brenton Horne brentonhorne77@gmail.com wrote:
Any one know how to overcome this problem, or are yas all stumped?
I've added some error handling to https://test2.wikipedia.org/wiki/Module:Molar_mass_calculator for you; most likely it was trying to use a quantity of empty-string for any elements you didn't specify in your Chembox, which tonumber() converts to nil. You could probably also have had your Chembox pass 0 as a default (e.g. {{{Ag|0}}} instead of {{{Ag|}}}).
If it's still not working, feel free to put your test cases on test2wiki so we can see them directly.