avoid showing empty tables
This commit is contained in:
parent
01efdd9877
commit
8f16640b66
35
init.lua
35
init.lua
@ -206,24 +206,29 @@ minetest.register_craftitem("metatools:stick",{
|
|||||||
-- .. (get_nodedef_field(nodename, "sunlight_propagates") and 'true' or 'false')
|
-- .. (get_nodedef_field(nodename, "sunlight_propagates") and 'true' or 'false')
|
||||||
-- )
|
-- )
|
||||||
|
|
||||||
|
local this_meta_to_table = meta:to_table()
|
||||||
minetest.chat_send_player(
|
if #this_meta_to_table > 0 then
|
||||||
username,
|
minetest.chat_send_player(
|
||||||
"[metatools::stick] metadata: "
|
username,
|
||||||
--.. delimit(meta:to_table()["fields"], "", "\n")
|
"[metatools::stick] metadata: "
|
||||||
)
|
--.. delimit(meta:to_table()["fields"], "", "\n")
|
||||||
send_messages(username, meta:to_table())
|
)
|
||||||
-- send_messages(username, meta:to_table()["fields"])
|
send_messages(username, this_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")
|
||||||
|
-- )
|
||||||
|
end
|
||||||
if meta["get_inventory"] then
|
if meta["get_inventory"] then
|
||||||
local inventory = meta:get_inventory()
|
local inventory = meta:get_inventory()
|
||||||
if inventory then -- this is never true for some reason
|
if inventory then -- this is never true for some reason
|
||||||
minetest.chat_send_player(username, "get_inventory():")
|
local this_inv_table = inv_to_table(inventory, true)
|
||||||
send_messages(username, inv_to_table(inventory, true))
|
if #this_inv_table > 0 then
|
||||||
|
minetest.chat_send_player(username, "get_inventory():")
|
||||||
|
send_messages(username, this_inv_table)
|
||||||
|
end
|
||||||
-- else
|
-- else
|
||||||
-- minetest.chat_send_player(username, "\tnil")
|
-- minetest.chat_send_player(username, "\tnil")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user