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.
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
.
PostAsync(url, data, contentType, compress, headers) → response
Identical to HttpService:PostAsync
.
The parameters for PostAsync
are as follows:
- The url parameter is the destination address for the data. It is a
string
. - The data parameter is the data being sent. It is a
string
. - The contentType parameter is modifies the value in the
Content-Type
header sent with the request. It is anEnum.HttpContentType
. It can also benil
. - The compress parameter is determines whether the data is compressed (gzipped) when sent. It is a
boolean
. It can also benil
. - The headers parameter is used to specify some HTTP request headers. It is a dictionary with keys that are
string
s and values that areany
s. It can also benil
.
The response return is the HTTP response sent back indicating the request result. It is a string
.
RequestAsync(options) → response
Identical to HttpService:RequestAsync
.
The options parameter is a ModemRequest
.
The response return is a ModemRequestResponse
.
SendLocalMessage(...)
Sends a message to all modems in the same region of the same NetworkID
.
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
.
GetRequest(domain) → response
This method is deprecated. This function still 'exists', but has no effect.
The domain parameter is a string
.
The response return is a string
.
PostRequest(domain, data)
This method is deprecated. This function still 'exists', but has no effect.
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
This method is deprecated. Use Modem:PostAsync
instead.
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
.
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
.