title: Split a string using string.gmatch() in Lua
body: <p>There are some discussions here, and utility functions, for splitting strings, but I need an ad-hoc one-liner for a very simple task.</p>
  
  <p>I have the following string:</p>
  
  <pre><code>local s = "one;two;;four"
  </code></pre>
  
  <p>And I want to split it on <code>";"</code>. I want, eventually, go get <code>{ "one", "two", "", "four" }</code> in return.</p>
  
  <p>So I tried to do:</p>
  
  <pre><code>local s = "one;two;;four"
  
  local words = {}
  for w in s:gmatch("([^;]*)") do table.insert(words, w) end
  </code></pre>
  
  <p>But the result (the <code>words</code> table) is <code>{ "one", "", "two", "", "", "four", "" }</code>. That's certainly not what I want.</p>
  
  <p>Now, as I remarked, there are some discussions here on splitting strings, but they have "lengthy" functions in them and I need something succinct. I need this code for a program where I show the merit of Lua, and if I add a lengthy function to do something so trivial it would go against me.</p>