title: Lua find a key from a value
body: <p>I'm working with this:</p>
  <pre class="lang-lua prettyprint-override"><code>chars = {
      [&quot;Nigo Astran&quot;] = &quot;1&quot;,
      [&quot;pantera&quot;] = &quot;2&quot;
  }
      
  nchar = chars[$name] + 1
  </code></pre>
  <p>The variable <code>$name</code> will give me a string that I'm logged in to, in this case: <code>&quot;Nigo Astran&quot;</code>
  and <code>nchar</code> has the value <code>&quot;2&quot;</code> if I'm in <code>&quot;Nigo Astran&quot;</code>, and so on. I believe you get the idea.</p>
  <p>Now, I want to get the <strong>key</strong> from the value, for example:</p>
  <p>when <code>nchar</code> is <code>&quot;2&quot;</code> it should give me <code>&quot;pantera&quot;</code> as the key. I'm just not getting the value of the key.</p>