Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fs = require "filesystem"
- local text = require "text"
- local path = "/etc/hosts"
- local dns = {}
- function dns.get(name)
- if not fs.exists(path) then return nil end
- local file = io.open(path, "r")
- for line in file:lines() do
- line = text.tokenize(line)
- if line[2] == name then return line[1] end
- end
- io.close(file)
- return nil
- end
- return dns
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement