title: How to get first character of string in Lua?
body: <p>Assuming I have a string in lua:</p>
  
  <pre><code>&gt; s = "abc123"
  </code></pre>
  
  <p>I want to get <code>s1</code> which is only the first character of s, or empty if <code>s</code> is empty.</p>
  
  <p>I've tried using </p>
  
  <pre><code>&gt; s1 = s[1]
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&gt; s1 = s[0]
  </code></pre>
  
  <p>How can I get the first character without using external Lua libraries</p>
  
  <p>but both only return <code>nil</code>.</p>