1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2024-12-26 10:50:27 +01:00

remove unnecessary pcall() around tonumber, as it will return nil for invalid input and not throw an exception

This commit is contained in:
Tim 2015-01-30 23:51:11 +01:00
parent f065349972
commit 4dc3f159c9

View File

@ -63,7 +63,7 @@ if pipeworks.enable_mese_sand_tube then
end, end,
on_receive_fields = function(pos,formname,fields,sender) on_receive_fields = function(pos,formname,fields,sender)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local _, dist = pcall(tonumber, fields.dist) local dist = tonumber(fields.dist)
if dist and 0 <= dist and dist <= 8 then if dist and 0 <= dist and dist <= 8 then
meta:set_int("dist", dist) meta:set_int("dist", dist)
meta:set_string("infotext", ("Adjustable Vacuuming Pneumatic Tube Segment (%dm)"):format(dist)) meta:set_string("infotext", ("Adjustable Vacuuming Pneumatic Tube Segment (%dm)"):format(dist))