minetest.register_on_punchnode(function(p, node, player)
if node.name=="default:dirt" then
local a=0
for a = 1,player:get_inventory():get_size('main') do
if not(player:get_inventory():get_list('main')[a]=="") then
local element=player:get_inventory():get_list("main")[a]:split(" ")
print(element[1])
print(element[2])
end
end
end
end)
Precisely here
local element=player:get_inventory():get_list("main")[a]:split(" ")
The code is used just to navigate in the inventory.
And retrieve the names of items and their numbers.
But player:get_inventory():get_list("main")[a] have nothing returns.
Thank for help.
Sorry for bad english.