| Blockland Forums > Modification Help |
| While loop Crash |
| (1/1) |
| Fluff-is-back:
Hi, I have recently been experimenting with text files but this bit of code, when executed, just crashes the game. --- Code: ---function testFO() { %fo = new FileObject(); %fo.openForRead("config/test.cs"); while(!%fo.isEOF) { %line = %fo.readLine(); echo(%line); } %fo.close(); %fo.delete(); } --- End code --- Could someone please explain what is wrong with this? |
| MegaScientifical:
--- Quote from: Fluff-is-back on December 20, 2010, 05:23:08 AM --- --- Code: ---function testFO() { %fo = new FileObject(); %fo.openForRead("config/test.cs"); while(!%fo.isEOF()) { %line = %fo.readLine(); echo(%line); } %fo.close(); %fo.delete(); } --- End code --- --- End quote --- You were missing "()" after "isEOF" which made it instead search for it as a variable. And since that never exists, it continuously loops forever. |
| Navigation |
| Message Index |