diff options
author | Kim Alvefur <zash@zash.se> | 2018-06-10 17:56:38 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-06-10 17:56:38 +0200 |
commit | 95f8eea9ca63cb7f29c8e12fb684b6042c6af39b (patch) | |
tree | 73727eb5ec93c048019ee773d3ea0ddc9404b9e7 /net/dns.lua | |
parent | 3807dcbeb3ffc348386428e75223adbf80c3bcff (diff) | |
parent | 5788d3bc5349809fa94420b7cd3a04e5f7df37b2 (diff) | |
download | prosody-95f8eea9ca63cb7f29c8e12fb684b6042c6af39b.tar.gz prosody-95f8eea9ca63cb7f29c8e12fb684b6042c6af39b.zip |
Merge 0.10->trunk
Diffstat (limited to 'net/dns.lua')
-rw-r--r-- | net/dns.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/net/dns.lua b/net/dns.lua index e015bca8..af5f1216 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -90,12 +90,20 @@ end local function augment (t, prefix) -- - - - - - - - - - - - - - - - - augment local a = {}; - for i = 1, 0xffff do - local s = t[i] or ("%s%d"):format(prefix, i); + for i,s in pairs(t) do a[i] = s; a[s] = s; a[string.lower(s)] = s; end + setmetatable(a, { + __index = function (_, i) + if type(i) == "number" then + return ("%s%d"):format(prefix, i); + elseif type(i) == "string" then + return i:upper(); + end + end; + }) return a; end |