From 2445a5b5d57a29d0ed2e7530692272a2cc301bd5 Mon Sep 17 00:00:00 2001 From: Wilma456 Date: Thu, 15 Jun 2017 14:50:47 +0200 Subject: [PATCH] Add Default to read() --- src/main/resources/assets/computercraft/lua/bios.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/resources/assets/computercraft/lua/bios.lua b/src/main/resources/assets/computercraft/lua/bios.lua index 714125938..383c3b754 100644 --- a/src/main/resources/assets/computercraft/lua/bios.lua +++ b/src/main/resources/assets/computercraft/lua/bios.lua @@ -276,12 +276,17 @@ function printError( ... ) end end -function read( _sReplaceChar, _tHistory, _fnComplete ) +function read( _sReplaceChar, _tHistory, _fnComplete, _sDefault ) term.setCursorBlink( true ) - local sLine = "" + local sLine + if type( _sDefault ) == "string" then + sLine = _sDefault + else + sLine = "" + end local nHistoryPos - local nPos = 0 + local nPos = #sLine if _sReplaceChar then _sReplaceChar = string.sub( _sReplaceChar, 1, 1 ) end