From 4fb0240a36c36d8a2b218a4e366f95a43a077016 Mon Sep 17 00:00:00 2001 From: Wilma456 Date: Sun, 24 Sep 2017 17:36:20 +0200 Subject: [PATCH] Changes suggested by SquidDev and update help file --- .../computercraft/core/apis/handles/EncodedInputHandle.java | 3 +-- src/main/resources/assets/computercraft/lua/rom/help/fs.txt | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/dan200/computercraft/core/apis/handles/EncodedInputHandle.java b/src/main/java/dan200/computercraft/core/apis/handles/EncodedInputHandle.java index 467330f63..9f722f797 100644 --- a/src/main/java/dan200/computercraft/core/apis/handles/EncodedInputHandle.java +++ b/src/main/java/dan200/computercraft/core/apis/handles/EncodedInputHandle.java @@ -5,7 +5,6 @@ import dan200.computercraft.api.lua.LuaException; import javax.annotation.Nonnull; import java.io.*; -import java.util.Arrays; import static dan200.computercraft.core.apis.ArgumentHelper.*; @@ -119,7 +118,7 @@ public class EncodedInputHandle extends HandleGeneric char[] bytes = new char[ count ]; count = m_reader.read( bytes ); if( count < 0 ) return null; - String str = new String( bytes ); + String str = new String( bytes, 0, count ); return new Object[] { str }; } catch( IOException e ) diff --git a/src/main/resources/assets/computercraft/lua/rom/help/fs.txt b/src/main/resources/assets/computercraft/lua/rom/help/fs.txt index 400e5ba6f..363273b12 100644 --- a/src/main/resources/assets/computercraft/lua/rom/help/fs.txt +++ b/src/main/resources/assets/computercraft/lua/rom/help/fs.txt @@ -22,6 +22,7 @@ Functions on files opened with mode "r": readLine() readAll() close() +read( number ) Functions on files opened with mode "w" or "a": write( string ) @@ -36,4 +37,4 @@ close() Functions on files opened with mode "wb" or "ab": write( byte ) flush() -close() \ No newline at end of file +close()