title: Can I run a function for the Lua shell prompt?
body: <p>I can set the prompt with <code>_PROMPT = &quot;&gt; &quot;</code>, but can I make the prompt update every time?</p>
  <p>I tried this, but it doesn't work:</p>
  <pre class="lang-lua prettyprint-override"><code>i = 0
  
  function inc()
      i = i + 1
      return i
  end
  
  _PROMPT = inc
  </code></pre>
  <p>This shows <code>_PROMPT</code>, but nothing related:</p>
  <pre class="lang-lua prettyprint-override"><code>for k, v in pairs(_G) do
      print(k)
  end
  </code></pre>