handle = hurl.Easy([table])
The optional table
argument allows you to get additional options for the easy object. It is possible to use
all options here that can also be get separately using the easy:SetOpt() command. For example, to
get #CURLOPT_URL
, #CURLOPT_VERBOSE
, and #CURLOPT_FOLLOWLOCATION
at creation time, just do the following:
e = hurl.Easy({URL = "http://www.hollywood-mal.com", Verbose = True, FollowLocation = True}) |
This code does the same as:
e = hurl.Easy() e:SetOpt_URL("http://www.hollywood-mal.com") e:SetOpt_Verbose(True) e:SetOpt_FollowLocation(True) |
Alternatively, you could also use easy:SetOpt() to get those options, like so:
e = hurl.Easy() e:SetOpt(#CURLOPT_URL, "http://www.hollywood-mal.com") e:SetOpt(#CURLOPT_VERBOSE, True) e:SetOpt(#CURLOPT_FOLLOWLOCATION, True) |
All of the code snippets above do exactly the same thing.