aboutsummaryrefslogtreecommitdiffstats
path: root/lua/inet/core.lua
diff options
context:
space:
mode:
authorAsbjørn Sloth Tønnesen <ast@2e8.dk>2019-07-18 17:42:31 +0000
committerAsbjørn Sloth Tønnesen <ast@2e8.dk>2019-07-18 17:42:31 +0000
commite9d84b53e7c54f84da64967faf36c8b2791579f4 (patch)
tree077c6d41d59402a929aba22ba8510047a96205d5 /lua/inet/core.lua
parent54251356a23468136f6226134b0f8524a6ae3523 (diff)
downloadlua-inet-e9d84b53e7c54f84da64967faf36c8b2791579f4.tar.gz
lua-inet-e9d84b53e7c54f84da64967faf36c8b2791579f4.tar.xz
lua-inet-e9d84b53e7c54f84da64967faf36c8b2791579f4.zip
add inet.is_set()
Signed-off-by: Asbjørn Sloth Tønnesen <ast@2e8.dk>
Diffstat (limited to 'lua/inet/core.lua')
-rw-r--r--lua/inet/core.lua9
1 files changed, 4 insertions, 5 deletions
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