# HG changeset patch # User Kim Alvefur # Date 1528646198 -7200 # Node ID dbb5ec6885fe72ca068fc3a93f0602b6beec6d80 # Parent f15e35458ecc54f05d57aea977da8c65804e7d63# Parent 144666d0ad2fd75be0554b337fd79c243f54bf62 Merge 0.10->trunk diff -r f15e35458ecc -r dbb5ec6885fe net/dns.lua --- 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