Skip to content

Client library

Mobil Game 06 edited this page Apr 24, 2022 · 11 revisions

Code Snippets

local dns = require('dns') -- import the library

dns.setAddress('ADRESS') -- sets the DNS server address

dns.setPort(404) -- sets the DNS Server port (default is 404)

dns.lookup('NAME') -- looks up a DNS and return the saved address as string. nil if there is no address false when the dns server could not be reached.

Sample:

-- This prints the address or write if the address exists or the server is down

local dns = require('dns') -- import the libary

dns.setAddress('4d2e4c6c-b70b-42b0-85db-d3ea1b27b3c0') -- sets the DNS server address

dns.setPort(404) -- sets the DNS server port, the default is 404

reply = dns.lookup('tutorial') -- look up a dns, in this case "tutorial" points to some address -- will return nil if there is no address corresponding to that dns -- will return false if the DNS server could not be reached -- will return string that contains the address for that DNS if everything went right

if reply == nil then print("Couldn't find that address.") lseif reply == false then print("Couldn't connect to DNS server.") else print("DNS Found! " .. reply) end

WIKI

Programm Tutorials

Other Wikis(EXTERNEL)

Clone this wiki locally