lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 8/1/2013 5:12 PM, Geoff Leyland wrote:
> Suppose I have the nonsense string "all all ball all" and I'd like to change all the "all"s (but not the ball) to "none".


Geoff,

Slow down, little fella.  You're over-thinking it.  This solves your problem without all the ugly percent signs

  ("all all ball all"):gsub(".+", "none none ball none")

Next, we do it an infinite number of times, to make sure

  while true do
    ("all all ball all"):gsub(".+", "none none ball none")
  end
  print("Whew! Its Miller Time. Hey, where'd the Universe go?")

Finally, shut down normally

  os.remove(arg[0])
  assert(false)

-jm