lua-users home
lua-l archive

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

Hello,  I am new to LUA and was trying to do some basic scripts to get a feel for it.  I have tried to make a basic script to parse through a log file and display simple output.  I have the following code which I thought I understood just fine.

print ("opening file for reading")
logfile ="system.log","r")
logstring = logfile:read("*all")

What is confusing me is, I can create a new text document, and just type a few words in it.  Then I can use this script (unless in my many variations I posted the wrong one) and get the text back out.  If I could get past this, I would then do some small matching off the log file.  Unfortunately it only works when I make my text document.  When I grab the actual log file I am trying to parse, it only returns a space, a square, and then the first character in the file.  When opening this log file in word pad it does look normal with line returns after each log entry.  In notepad however the line returns are shown as squares.  I am therefore led to believe this must have something to do with formatting of this file, but I really don't know.  Can anyone point me in the right direction here?  I just don't see how these line returns could be the problem when it does not even parse that far, it just gets to the first character.

Thanks for helping a new guy out,

"Faithless is he, who says 'farewell', when the path darkens
"you just keep on trying till you run out of cake"