Advanced Peripherals

Advanced Peripherals

29M Downloads

Slot indices are 0-based instead of 1-based

RobertBouillon opened this issue ยท 2 comments

commented

Describe

Slot filter arguments start at index 0 instead of 1. Lua indices are 1-based, so it makes it difficult to write code that interoperates with the peripheral API.

Indices should be 1-based to be consistent with Lua and CC:T standards.

Steps to reproduce

image

  1. Connect an ME Bridge and vanilla chest to a wired network
  2. Create an ME system with item storage and connect it to the ME Bridge
  3. Place items in the first and second slots of the chest
  4. Run the following code;
local chestName = "left"
local chest = peripheral.wrap(chestName)
local bridge = peripheral.wrap("right")
for slot in pairs(chest.list()) 
  bridge.importItemFromPeripheral({fromSlot=slot},chestName)) 
end

Expected Results

All items are moved from the chest into the ME system

Actual Results

Slot 0 still contains the original item

Workaround

Reduce the indices sent to the ME Bridge by 1

Multiplayer?

Yes

Version

1.19.2-0.7.34r (Latest 1.19.2)

Minecraft, Forge and maybe other related mods versions

1.19.2 / Skies Expert

Screenshots or Videos

No response

Crashlog/log

No response

commented

This is a breaking change and should fix in 0.8

commented

Reopen until released