title: Lua check if a number/value is nan
body: <p>I have written a program to print a matrix after some computations and I am getting an output of <code>nan</code> for all elements. I want to break a <code>for</code> loop as soon as the matrix's first element becomes <code>nan</code> to understand the problem. How can I do this? In the terminal, I have printed the matrix <code>a</code> containing <code>nan</code> as all elements and typed <code>a[1][1]=="nan"</code> and <code>a[{{1},{1}}]=="nan"</code> both of which return <code>false</code>. Why are they not returning <code>false</code> and what statement should I use instead?</p>