More variable == nil checks.

This commit is contained in:
Duane 2016-06-27 08:06:26 -05:00
parent a0fac75def
commit 4704b4cf2b

View file

@ -325,6 +325,9 @@ minetest.register_craft({
local function translocate(pos, node, clicker, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
local id = meta:get_string('id')
if not (id and tonumber(id)) then
return
end
local pair = fun_caves.db.translocators[tonumber(id)]
if not pair or #pair < 2 then
return
@ -344,6 +347,9 @@ local function trans_use(itemstack, user, pointed_thing)
return
end
local data = minetest.deserialize(itemstack:get_metadata())
if not (data and data.id) then
return
end
local player_name = user:get_player_name()
minetest.chat_send_player(player_name, "You see a serial number: "..data.id)
end
@ -354,6 +360,9 @@ local function trans_place(itemstack, placer, pointed_thing)
end
local data = minetest.deserialize(itemstack:get_metadata())
if not (data and data.id) then
return
end
local pos = pointed_thing.above
local pair = fun_caves.db.translocators[tonumber(data.id)]
if #pair > 1 then