Advertisement
serafim7

данные предмета из сундука со вложенной таблицей OpenPeripheral

Nov 24th, 2021
1,277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.46 KB | None | 0 0
  1. local com = require("component")
  2. local chest = com.isAvailable("chest") and com.chest or error("нет сундука")
  3. local size = chest.getInventorySize()
  4.  
  5. local data = chest.getAllStacks(0)
  6. for slot = 1,size do
  7.   if data[slot] then
  8.     for name, value in pairs(data[slot]) do
  9.       if type(value) == "table" then
  10.         for a, b in pairs(value) do
  11.           print(a,b)
  12.         end
  13.       else
  14.         print(name.." = "..value)
  15.       end
  16.     end
  17.   end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement