CC Open Peripherals Getting item name

bgsteiner

New Member
Jul 29, 2019
222
0
0
So i have been using a modified version of DW's portal manager for some time but for some reason everything has stopped working due to one issue I am no longer able to get the name of an item in the chest inventory. Normally I would use the following

Code:
function checkSlots(id)
   data = {}
   local slot
   local name
   local slots = p.getAllStacks()
   for i,j in pairs(slots) do
      slot = i
      name = j["display_name"]
--      print(name)
      data[slot]=name
   end
   rednet.send(id,"done")
end

but for some reason display_name returns a blank string now I have tried name=j["name"] and several other variants but for some reason it still returns a blank line for every item in the inventory

Any ideas on this would be greatly appriciated
 

adamich

New Member
Jul 29, 2019
697
0
0
Code:
print(name)
is it print correct names?
also try
Code:
local slots = p.getAllStacks(true)
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,799
248
is it not that you need to use p.getAllStacks(false) to get the table?
 

adamich

New Member
Jul 29, 2019
697
0
0
mmm,
Code:
p.getAllStacks(true)
return more information than
Code:
p.getAllStacks(false)
or
Code:
p.getAllStacks()
 

adamich

New Member
Jul 29, 2019
697
0
0
also in CC computer/turtle try in
Code:
lua
local items=p.getAllStacks(true)  _or_ (false) _or_ ()
local item=items[0]
for i,j in pairs(item) do print (i,j)
it will print all field names and values of single item