From 88f41314c70b34350b2ac9e4fdc1b50caefbce1c Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Mon, 28 Jun 2021 22:47:56 +0100 Subject: [PATCH 1/2] Make io handles opaque to the docs Yep, this is kinda gross. But also a nice refactor --- .../data/computercraft/lua/rom/apis/io.lua | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/main/resources/data/computercraft/lua/rom/apis/io.lua b/src/main/resources/data/computercraft/lua/rom/apis/io.lua index 4898df308..061033eee 100644 --- a/src/main/resources/data/computercraft/lua/rom/apis/io.lua +++ b/src/main/resources/data/computercraft/lua/rom/apis/io.lua @@ -173,27 +173,25 @@ handleMetatable = { }, } -local defaultInput = setmetatable({ - _handle = { readLine = _G.read }, -}, handleMetatable) +local function make_file(handle) + return setmetatable({ _handle = handle }, handleMetatable) +end -local defaultOutput = setmetatable({ - _handle = { write = _G.write }, -}, handleMetatable) +local defaultInput = make_file({ readLine = _G.read }) -local defaultError = setmetatable({ - _handle = { - write = function(...) - local oldColour - if term.isColour() then - oldColour = term.getTextColour() - term.setTextColour(colors.red) - end - _G.write(...) - if term.isColour() then term.setTextColour(oldColour) end - end, - }, -}, handleMetatable) +local defaultOutput = make_file({ write = _G.write }) + +local defaultError = make_file({ + write = function(...) + local oldColour + if term.isColour() then + oldColour = term.getTextColour() + term.setTextColour(colors.red) + end + _G.write(...) + if term.isColour() then term.setTextColour(oldColour) end + end, +}) local currentInput = defaultInput local currentOutput = defaultOutput @@ -316,7 +314,7 @@ function open(filename, mode) local file, err = fs.open(filename, sMode) if not file then return nil, err end - return setmetatable({ _handle = file }, handleMetatable) + return make_file(file) end --- Get or set the current output file. From 1650b72edb01596ba38e15c1f97e66ed14f0420e Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Mon, 28 Jun 2021 22:52:01 +0100 Subject: [PATCH 2/2] Prepare for 1.97.0 release --- gradle.properties | 2 +- .../computercraft/lua/rom/help/changelog.md | 26 ++++++++++++++ .../computercraft/lua/rom/help/whatsnew.md | 36 +++++++++++-------- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/gradle.properties b/gradle.properties index 247878e0a..1a7fad24c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Mod properties -mod_version=1.96.0 +mod_version=1.97.0 # Minecraft properties (update mods.toml when changing) mc_version=1.15.2 diff --git a/src/main/resources/data/computercraft/lua/rom/help/changelog.md b/src/main/resources/data/computercraft/lua/rom/help/changelog.md index 2f02e10cd..3f4a12af0 100644 --- a/src/main/resources/data/computercraft/lua/rom/help/changelog.md +++ b/src/main/resources/data/computercraft/lua/rom/help/changelog.md @@ -1,3 +1,29 @@ +# New features in CC: Tweaked 1.97.0 + +* Update several translations (Anavrins, Jummit, Naheulf). +* Add button to view a computer's folder to `/computercraft dump`. +* Allow cleaning dyed turtles in a cauldron. +* Add scale subcommand to `monitor` program (MCJack123). +* Add option to make `textutils.serialize` not write an indent (magiczocker10). +* Allow comparing vectors using `==` (fatboychummy). +* Improve HTTP error messages for SSL failures. +* Allow `craft` program to craft unlimited items (fatboychummy). +* Impose some limits on various command queues. +* Add buttons to shutdown and terminate to computer GUIs. +* Add program subcompletion to several programs (Wojbie). +* Update the `help` program to accept and (partially) highlight markdown files. +* Remove config option for the debug API. +* Allow setting the subprotocol header for websockets. + +And several bug fixes: +* Fix NPE when using a treasure disk when no treasure disks are available. +* Prevent command computers discarding command ouput when certain game rules are off. +* Fix turtles not updating peripherals when upgrades are unequipped (Ronan-H). +* Fix computers not shutting down on fatal errors within the Lua VM. +* Speakers now correctly stop playing when broken, and sound follows noisy turtles and pocket computers. +* Update the `wget` to be more resiliant in the face of user-errors. +* Fix exiting `paint` typing "e" in the shell. + # New features in CC: Tweaked 1.96.0 * Use lightGrey for folders within the "list" program. diff --git a/src/main/resources/data/computercraft/lua/rom/help/whatsnew.md b/src/main/resources/data/computercraft/lua/rom/help/whatsnew.md index f853dbd32..b715d13f2 100644 --- a/src/main/resources/data/computercraft/lua/rom/help/whatsnew.md +++ b/src/main/resources/data/computercraft/lua/rom/help/whatsnew.md @@ -1,19 +1,27 @@ -New features in CC: Tweaked 1.96.0 +New features in CC: Tweaked 1.97.0 -* Use lightGrey for folders within the "list" program. -* Add getLimit to inventory peripherals. -* Expose the generic peripheral system to the public API. -* Add cc.expect.range (Lupus590). -* Allow calling cc.expect directly (MCJack123). -* Numerous improvements to documentation. +* Update several translations (Anavrins, Jummit, Naheulf). +* Add button to view a computer's folder to `/computercraft dump`. +* Allow cleaning dyed turtles in a cauldron. +* Add scale subcommand to `monitor` program (MCJack123). +* Add option to make `textutils.serialize` not write an indent (magiczocker10). +* Allow comparing vectors using `==` (fatboychummy). +* Improve HTTP error messages for SSL failures. +* Allow `craft` program to craft unlimited items (fatboychummy). +* Impose some limits on various command queues. +* Add buttons to shutdown and terminate to computer GUIs. +* Add program subcompletion to several programs (Wojbie). +* Update the `help` program to accept and (partially) highlight markdown files. +* Remove config option for the debug API. +* Allow setting the subprotocol header for websockets. And several bug fixes: -* Fix paintutils.drawLine incorrectly sorting coordinates (lilyzeiset). -* Improve JEI's handling of turtle/pocket upgrade recipes. -* Correctly handle sparse arrays in cc.pretty. -* Fix crashes when a turtle places a monitor (baeuric). -* Fix very large resource files being considered empty. -* Allow turtles to use compostors. -* Fix dupe bug when colouring turtles. +* Fix NPE when using a treasure disk when no treasure disks are available. +* Prevent command computers discarding command ouput when certain game rules are off. +* Fix turtles not updating peripherals when upgrades are unequipped (Ronan-H). +* Fix computers not shutting down on fatal errors within the Lua VM. +* Speakers now correctly stop playing when broken, and sound follows noisy turtles and pocket computers. +* Update the `wget` to be more resiliant in the face of user-errors. +* Fix exiting `paint` typing "e" in the shell. Type "help changelog" to see the full version history.