QType objects

The QType class lets you deal easily with the different kind of resource types, like ‘A’, ‘NS’, ‘CNAME’, etc. These types have both a name and a number. This class helps seamlessly move between them.

Functions and methods of a QType

newQType(name) → QType

Returns a new QType object from name. Name can either contain the code of the type prefixed with a sharp character, or its name directly

Parameters:name (string) – The name of the QType
type = newQType("CNAME")
anothertype = newQType("#5")
if type == anothertype then -- prints "equal!"
  print('equal!')
end
class QType

It has these methods:

QType:getCode() -> int

Returns the numeric code corresponding to the type

QType:getName() -> string

Returns the name of the type