show actual inventory slot number
This commit is contained in:
parent
fa471185a7
commit
01efdd9877
46
init.lua
46
init.lua
@ -129,7 +129,7 @@ local function inv_to_table(inv, blank)
|
|||||||
return results
|
return results
|
||||||
end
|
end
|
||||||
|
|
||||||
local function send_messages(username, table, tab)
|
local function send_messages(username, table, tab, blank)
|
||||||
if not tab then
|
if not tab then
|
||||||
tab = ""
|
tab = ""
|
||||||
end
|
end
|
||||||
@ -138,15 +138,17 @@ local function send_messages(username, table, tab)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
for k, v in pairs(table) do
|
for k, v in pairs(table) do
|
||||||
if type(v) == "table" then
|
if blank or ((v ~= nil) and (dump(v) ~= "") and (dump(v) ~= "\"\"")) then
|
||||||
minetest.chat_send_player(username, tab .. k .. ":")
|
if type(v) == "table" then
|
||||||
send_messages(username, v, tab.."\t")
|
minetest.chat_send_player(username, tab .. k .. ":")
|
||||||
elseif k == "formspec" then
|
send_messages(username, v, tab.."\t")
|
||||||
minetest.chat_send_player(username, tab .. k .. ":")
|
elseif k == "formspec" then
|
||||||
local chunks = split_and_keep_token(v, "]")
|
minetest.chat_send_player(username, tab .. k .. ":")
|
||||||
send_messages_sequence(username, chunks, tab.."\t")
|
local chunks = split_and_keep_token(v, "]")
|
||||||
else
|
send_messages_sequence(username, chunks, tab.."\t")
|
||||||
minetest.chat_send_player(username, tab..k..":"..dump(v))
|
else
|
||||||
|
minetest.chat_send_player(username, tab..k..":"..dump(v))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -210,23 +212,23 @@ minetest.register_craftitem("metatools:stick",{
|
|||||||
"[metatools::stick] metadata: "
|
"[metatools::stick] metadata: "
|
||||||
--.. delimit(meta:to_table()["fields"], "", "\n")
|
--.. delimit(meta:to_table()["fields"], "", "\n")
|
||||||
)
|
)
|
||||||
-- send_messages(username, meta:to_table()["fields"])
|
|
||||||
send_messages(username, meta:to_table())
|
send_messages(username, meta:to_table())
|
||||||
minetest.chat_send_player(
|
-- send_messages(username, meta:to_table()["fields"])
|
||||||
username,
|
-- minetest.chat_send_player(
|
||||||
"[metatools::stick] inventory: "
|
-- username,
|
||||||
--.. delimit(meta:to_table()["fields"], "", "\n")
|
-- "[metatools::stick] inventory: "
|
||||||
)
|
-- --.. delimit(meta:to_table()["fields"], "", "\n")
|
||||||
|
-- )
|
||||||
if meta["get_inventory"] then
|
if meta["get_inventory"] then
|
||||||
local inventory = meta:get_inventory()
|
local inventory = meta:get_inventory()
|
||||||
minetest.chat_send_player(username, "get_inventory():")
|
|
||||||
if inventory then -- this is never true for some reason
|
if inventory then -- this is never true for some reason
|
||||||
send_messages(username, inv_to_table(inventory))
|
minetest.chat_send_player(username, "get_inventory():")
|
||||||
else
|
send_messages(username, inv_to_table(inventory, true))
|
||||||
minetest.chat_send_player(username, "\tnil")
|
-- else
|
||||||
|
-- minetest.chat_send_player(username, "\tnil")
|
||||||
end
|
end
|
||||||
else
|
-- else
|
||||||
minetest.chat_send_player(username, "get_inventory():")
|
-- minetest.chat_send_player(username, "get_inventory:nil")
|
||||||
end
|
end
|
||||||
local airname = minetest.get_name_from_content_id(minetest.CONTENT_AIR)
|
local airname = minetest.get_name_from_content_id(minetest.CONTENT_AIR)
|
||||||
-- local litnode = nil
|
-- local litnode = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user