Hey, any help here would be greatly appreciated. I was trying to do some simple programs to learn some LUA and possibly later make an addon. I thought I was going to just parse through the log files for something simple and then print it out. I got a stand alone lua executible so I could just try the LUA first before trying to get anything working in WAR.
So I generated the following few lines of code just to try this out...
This is the first [ of the file, and it never reads the rest. I then tried making my own .txt file and it reads it just fine. Now I am confused. What is it about the log files from WAR that it stops reading? Can anyone point me in the right direction here?
It appears that the output isn't exactly what I see in my command prompt. It is a space, followed by a filled in square, followed by the "[", which would be the correct first character of the file. If I write something at the beginning of the file, I get the first letter of the sentence but the rest is the same. It just doesn't parse it like a text file. I have also tried adding a "rb" instead of "r" for the mode, to see if "binary" mode made any difference. Unfortunately this did not help.
Well... I still don't know if it is even possible to call the io.open fucntions of LUA from with in WAR. But I do have an answer as to why my stand along LUA script wasn't able to parse the log file. They format the log files in UTF-16 (I believe) so it was causing errors trying to print it back out.
Opening the file in a Hex editor reveals that it is not a standard text file (UTF-8). So the following line of code was provided from my questions on the LUA mailing list. I wish I could remember now who provided it, but that is at home. So no credit here for me at all.. but here is the code that helped me get a string I could parse.
The third line is the new line which subs blank string for the recognized characters. Again I am not actually doing anything in WAR right now, but rather testing LUA functionality and if this can help anyone else... then there ya go.