1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-10-31 23:26:19 +00:00

Fix peripheral.getMethods returning {}

I don't even know how this snuck past.

Closes #346
This commit is contained in:
SquidDev 2020-01-14 08:45:08 +00:00
parent 018ecfbaa0
commit 8b1773dd60
4 changed files with 10 additions and 16 deletions

View File

@ -1,5 +1,5 @@
# Mod properties # Mod properties
mod_version=1.86.1 mod_version=1.86.2
# Minecraft properties # Minecraft properties
mc_version=1.12.2 mc_version=1.12.2

View File

@ -364,20 +364,17 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange
case 2: case 2:
{ {
// getMethods // getMethods
String[] methods = null;
ComputerSide side = ComputerSide.valueOfInsensitive( getString( args, 0 ) ); ComputerSide side = ComputerSide.valueOfInsensitive( getString( args, 0 ) );
if( side != null ) if( side != null )
{ {
synchronized( m_peripherals ) synchronized( m_peripherals )
{ {
PeripheralWrapper p = m_peripherals[side.ordinal()]; PeripheralWrapper p = m_peripherals[side.ordinal()];
if( p != null ) if( p != null ) return new Object[] { p.getMethods() };
{
methods = p.getMethods();
}
} }
} }
return methods != null ? new Object[] { new HashMap<>() } : null;
return null;
} }
case 3: case 3:
{ {

View File

@ -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 # New features in CC: Tweaked 1.86.1
* Add a help message to the Lua REPL's exit function * Add a help message to the Lua REPL's exit function

View File

@ -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 * Fix peripheral.getMethods returning an empty table
* 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`.
Type "help changelog" to see the full version history. Type "help changelog" to see the full version history.