public static LuaValue freaduntil(File f, boolean lineonly) throws IOException {
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		int c;
		try {
			if (lineonly) {
				loop: while ((c = f.read()) > 0) {
					switch (c) {
					case '\r':
						break;
					case '\n':
						break loop;
					default:
						baos.write(c);
						break;
					}
				}
			} else {
				while ((c = f.read()) > 0)
					baos.write(c);
			}
		} catch (EOFException e) {
			c = -1;
		}
		return (c < 0 && baos.size() == 0) ? (LuaValue) NIL : (LuaValue) LuaString.valueUsing(baos.toByteArray());
	}