Software /
code /
prosody
Diff
net/dns.lua @ 8909:dbb5ec6885fe
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 10 Jun 2018 17:56:38 +0200 |
parent | 8903:c5d5dfaa8d38 |
parent | 8908:144666d0ad2f |
child | 9952:6402bc76f51a |
line wrap: on
line diff
--- a/net/dns.lua Sun Jun 10 01:20:05 2018 +0200 +++ b/net/dns.lua Sun Jun 10 17:56:38 2018 +0200 @@ -90,12 +90,20 @@ 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