From e9d84b53e7c54f84da64967faf36c8b2791579f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= Date: Thu, 18 Jul 2019 17:42:31 +0000 Subject: add inet.is_set() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Asbjørn Sloth Tønnesen --- lua/inet/core.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lua/inet/core.lua') diff --git a/lua/inet/core.lua b/lua/inet/core.lua index 4a5e14f..f9ff6e1 100644 --- a/lua/inet/core.lua +++ b/lua/inet/core.lua @@ -1,5 +1,7 @@ local bit32 = require 'bit32' +local common = require 'inet.common' + local format = string.format local lshift = bit32.lshift @@ -8,6 +10,8 @@ local band = bit32.band local replace = bit32.replace local bxor = bit32.bxor +local get_mt = common.get_mt + local mt2fam = {} local inet = {} @@ -21,11 +25,6 @@ local inet6 = setmetatable({}, inet) inet6.__index = inet6 mt2fam[inet6] = 6 -local function get_mt(t) - if type(t) ~= 'table' then return nil end - return getmetatable(t) -end - local function is_inet4(t) local mt = get_mt(t) return mt == inet4 -- cgit v1.2.1