Software /
code /
prosody
Changeset
8909:dbb5ec6885fe
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 10 Jun 2018 17:56:38 +0200 |
parents | 8906:f15e35458ecc (current diff) 8908:144666d0ad2f (diff) |
children | 8910:28ec1e024379 |
files | net/dns.lua |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
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