From 8b1773dd6019eb9ec5e7dfff44f1568518c2c930 Mon Sep 17 00:00:00 2001 From: SquidDev Date: Tue, 14 Jan 2020 08:45:08 +0000 Subject: [PATCH] Fix peripheral.getMethods returning {} I don't even know how this snuck past. Closes #346 --- gradle.properties | 2 +- .../dan200/computercraft/core/apis/PeripheralAPI.java | 9 +++------ .../assets/computercraft/lua/rom/help/changelog.txt | 4 ++++ .../assets/computercraft/lua/rom/help/whatsnew.txt | 11 ++--------- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0b7c88e52..0f6aa539a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Mod properties -mod_version=1.86.1 +mod_version=1.86.2 # Minecraft properties mc_version=1.12.2 diff --git a/src/main/java/dan200/computercraft/core/apis/PeripheralAPI.java b/src/main/java/dan200/computercraft/core/apis/PeripheralAPI.java index c957af8b2..c289c85a2 100644 --- a/src/main/java/dan200/computercraft/core/apis/PeripheralAPI.java +++ b/src/main/java/dan200/computercraft/core/apis/PeripheralAPI.java @@ -364,20 +364,17 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange case 2: { // getMethods - String[] methods = null; ComputerSide side = ComputerSide.valueOfInsensitive( getString( args, 0 ) ); if( side != null ) { synchronized( m_peripherals ) { PeripheralWrapper p = m_peripherals[side.ordinal()]; - if( p != null ) - { - methods = p.getMethods(); - } + if( p != null ) return new Object[] { p.getMethods() }; } } - return methods != null ? new Object[] { new HashMap<>() } : null; + + return null; } case 3: { diff --git a/src/main/resources/assets/computercraft/lua/rom/help/changelog.txt b/src/main/resources/assets/computercraft/lua/rom/help/changelog.txt index 351e3784c..ae073d005 100644 --- a/src/main/resources/assets/computercraft/lua/rom/help/changelog.txt +++ b/src/main/resources/assets/computercraft/lua/rom/help/changelog.txt @@ -1,3 +1,7 @@ +# New features in CC: Tweaked 1.86.2 + +* Fix peripheral.getMethods returning an empty table + # New features in CC: Tweaked 1.86.1 * Add a help message to the Lua REPL's exit function diff --git a/src/main/resources/assets/computercraft/lua/rom/help/whatsnew.txt b/src/main/resources/assets/computercraft/lua/rom/help/whatsnew.txt index 04137ac9f..0ded4f8d3 100644 --- a/src/main/resources/assets/computercraft/lua/rom/help/whatsnew.txt +++ b/src/main/resources/assets/computercraft/lua/rom/help/whatsnew.txt @@ -1,12 +1,5 @@ -New features in CC: Tweaked 1.86.1 +New features in CC: Tweaked 1.86.2 -* Add a help message to the Lua REPL's exit function -* Add more MOTD messages. (osmarks) -* GPS requests are now made anonymously (osmarks) -* Minor memory usage improvements to Cobalt VM. - -And several bug fixes: -* Fix error when calling `write` with a number. -* Add missing assertion to `io.write`. +* Fix peripheral.getMethods returning an empty table Type "help changelog" to see the full version history.