Modem
A part that allows you to send messages cross-region and make HTTP requests to the web.
It is a craftable and spawnable non-flammable solid.
It cannot be resized.
At its default size (4x5x2) it has a durability of 1.
By default, its colour is #444444.
It requires 5 Antenna
, 150 Quartz
, and 25 Wire
to be crafted.
Methods
GetAsync(url, nocache, headers) → response
Identical to HttpService:GetAsync
.
The parameters for GetAsync
are as follows:
- The url parameter is a
string
. - The nocache parameter is a
boolean
. It can also benil
. - The headers parameter is a dictionary with keys that are
string
s and values that areany
s. It can also benil
.
The response return is a string
.
GetRequest(domain) → response
The domain parameter is a string
.
The response return is a string
.
PostAsync(url, data, contentType, compress, headers) → response
Identical to HttpService:PostAsync
.
The parameters for PostAsync
are as follows:
- The url parameter is a
string
. - The data parameter is a
string
. - The contentType parameter is an
Enum.HttpContentType
. It can also benil
. - The compress parameter is a
boolean
. It can also benil
. - The headers parameter is a dictionary with keys that are
string
s and values that areany
s. It can also benil
.
The response return is a string
.
PostRequest(domain, data)
The parameters for PostRequest
are as follows:
- The domain parameter is a
string
. - The data parameter is a
string
.
RealPostRequest(domain, data, asyncBool, transformFunction, optionalHeaders) → response
The parameters for RealPostRequest
are as follows:
- The domain parameter is a
string
. - The data parameter is a
string
. - The asyncBool parameter is a
boolean
. - The transformFunction parameter is a function of type
(...any) -> ()
. - The optionalHeaders parameter is a dictionary with keys that are
string
s and values that areany
s. It can also benil
.
The response return is a dictionary:
response
is astring
.success
is aboolean
.
RequestAsync(options) → response
Identical to HttpService:RequestAsync
.
The options parameter is a ModemRequest
.
The response return is a ModemRequestResponse
.
SendLocalMessage(...)
The variadic parameter is unknown. It can be anything.
SendMessage(data, id)
The parameters for SendMessage
are as follows:
- The data parameter is a
string
. - The id parameter is a
string
. It can also benil
.
UrlEncode(input) → encodedUrl
The UrlEncode
function percent-encodes a given string so that reserved characters properly encoded with '%' and two hexadecimal characters.
Identical to HttpService:UrlEncode
.
The input parameter is a string
.
The encodedUrl return is a string
.
Configurables
NetworkID
The ID of the network this modem should connect to. It is a string
.
Events
Loop(deltaTime)
Fires when the object is updated by the game loop.
The deltaTime parameter is the 'time' since the last tick, it does not represent the actual time since the last tick was occurred, rather just how often a game tick should be fired (it will always be precisely 1
). It is a number
.