14.01.2016, 16:31
(This post was last modified: 14.01.2016, 16:34 by HammelGammel.)
First the good message: Just printing the buffer prints out the full lines now!
Unfortunately it seems now I'm having a few more problems with the fileloader
First of all formatting the string still crashes and concatenation still cuts the string down to 4 letters. buffer.len() will always return 4 btw, even if print(buffer) prints a much much longer string. While string.find works perfectly fine, string.slice gives me "slice out of range", even though I know that the slice is fine. It seems to think that the string only has 4 letters. In this specific example the line in question has about 20 letters: string.find returns me 7. So far so good. But a slice from 0 to 7 is "out of range", and buffer.len() gives me 4. This is really interesting. How can this happen? It seems to be just a normal string (At least type()) tells me so, but something must be different with the string fileRead gives me.
Also fileClose gives me extremely weird errors (When it doesn't crash, which most of the time it does) in another file, that just blatantly don't make any sense at all: "Error runtime: the index '_PORTALTEMPEL_RITUAL_04;NW_TROLLAREA_PORTALTEMPEL_' does not exist". The string from the errormessage is a seemingly random part (Not a full line) from the file I am reading in an entirely different part of the code. Removing fileClose fixes it, but I'm assuming it's not a good thing to not close the file.
EDIT: Well, most of the time removing fileClose fixes it O.o But not always... It's kind of random. When using fileClose it always happens though.
Any ideas what I can do? I could really use some way of reading files, and long lines still cause all kinds of problems for me unfortunately.
Unfortunately it seems now I'm having a few more problems with the fileloader

First of all formatting the string still crashes and concatenation still cuts the string down to 4 letters. buffer.len() will always return 4 btw, even if print(buffer) prints a much much longer string. While string.find works perfectly fine, string.slice gives me "slice out of range", even though I know that the slice is fine. It seems to think that the string only has 4 letters. In this specific example the line in question has about 20 letters: string.find returns me 7. So far so good. But a slice from 0 to 7 is "out of range", and buffer.len() gives me 4. This is really interesting. How can this happen? It seems to be just a normal string (At least type()) tells me so, but something must be different with the string fileRead gives me.
Also fileClose gives me extremely weird errors (When it doesn't crash, which most of the time it does) in another file, that just blatantly don't make any sense at all: "Error runtime: the index '_PORTALTEMPEL_RITUAL_04;NW_TROLLAREA_PORTALTEMPEL_' does not exist". The string from the errormessage is a seemingly random part (Not a full line) from the file I am reading in an entirely different part of the code. Removing fileClose fixes it, but I'm assuming it's not a good thing to not close the file.
EDIT: Well, most of the time removing fileClose fixes it O.o But not always... It's kind of random. When using fileClose it always happens though.
Any ideas what I can do? I could really use some way of reading files, and long lines still cause all kinds of problems for me unfortunately.