title: counting number of string occurrences
body: <p>I'm trying to count the number of times that " --" occurs in a string.</p>
  
  <p>So for instance, it occurs twice here 'a --b --c'</p>
  
  <p>I tried the following, but it gives me 4 instead of 2, any idea why?</p>
  
  <pre><code>argv='a --b --c'
  count = 0
  for i in string.gfind(argv, " --") do
     count = count + 1
  end
  print(count)
  </code></pre>