lua-users home
lua-l archive

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


Hi all,
I encountered a strange problem using gsub:

Say I have function like this:
function log(date,msg)
   pat = "%date %str"
   ostr = string.gsub(pat,"%%date",date)
   ostr= string.gsub(ostr,"%%str",msg)
   print(ostr) 
end

Now log(os.date(),"strange string %4 is this")
yields:

stdin:4: invalid capture index
stack traceback:
        [C]: in function `gsub'
        stdin:4: in function `log'
        stdin:1: in main chunk
        [C]: ?


What do I do wrong? 



-- 
Manfred