lua-users home
lua-l archive

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

On 9/18/07, Thomas A. Schmitz <> wrote:
> Wow, that was fast! Thanks so much, that does exactly what I want.
> I'll need to iterate over the file several times, but that's not a
> problem!

I'm afraid you're about to do something the hard way, so forgive me if
I misunderstood you. Here is what you probably should do (and what I
meant earlier):



local subs = {
a = "α",
b = "β"

local function mysubs(lines)
  for i,v in pairs(subs) do
    lines = string.gsub(lines, i, v);
  return lines;

file = io.stdin:read("*all");

file = string.gsub(file, "localgreek(%b{})", function(lines)
     return "localgreek"..mysubs(lines);




-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."

-Will Durant