I/O & HTTP¶
Filesystem¶
Read file¶
Reads the content of the file at path
as a string.
This works with plain-text and binary files.
Write file¶
Writes the string content
to the file located at path
. Only string content is supported.
Clipboard¶
Get clipboard¶
Returns the text that is saved to the host machine's clipboard.
Typically achieved by doing Ctrl+V.
Set clipboard¶
Stores text
in the host machine's clipboard.
Mouse/Keyboard¶
Self-explanatory I/O functions which are supported:
function mouse1click(): void
function mouse1down(): void
function mouse1up(): void
function mouse2click(): void
function mouse2down(): void
function mouse2up(): void
function presskey(): void
function releasekey(): void
HTTP¶
HTTP GET¶
Requests the content at url
and returns it's body as a plain-text string.
Synapse request (syn.request)¶
Name | Type | Required | Description |
---|---|---|---|
Url |
string |
The target URL for this request. Must use http or https protocols. |
|
Method |
string |
The HTTP method being used by this request. Most often GET or POST . Defaults to GET . |
|
Headers |
dictionary |
A dictionary of headers to be used with this request. Most HTTP headers are accepted here, but not all. |
|
Cookies |
dictionary |
A dictionary of cookies to be used with this request. | |
Body |
string |
The request body . Can be any string or binary data. Must be excluded when using the GET /HEAD HTTP methods. It might be necessary to specify the Content-Type header when sending JSON or other formats. |
Name | Type | Description |
---|---|---|
Success |
bool |
The success status of the request. This is true if and only if the StatusCode lies within the range [200, 299]. |
StatusCode |
number |
The HTTP response code identifying the status of the response. |
StatusMessage |
string |
The status message that was sent back. |
Headers |
dictionary |
A dictionary of headers that were set in this response. |
Cookies |
dictionary |
A dictionary of cookies that were set in this |
Body |
string |
The request body (content) received in the response. |
local response = syn.request(
{
Url = "http://httpbin.org/post", -- This website helps debug HTTP requests
Method = "POST",
Headers = {
["Content-Type"] = "application/json" -- When sending JSON, set this!
},
Body = game:GetService("HttpService"):JSONEncode({hello = "world"})
}
)
for i,v in pairs(response) do
print(i,v)
if type(v) == "table" then
for i2,v2 in pairs(v) do
warn(i2,v2)
end
end
end
You can refer to S^X docs.
Deprecation note
game:HttpGet
and game:HttpGetAsync
are supported for legacy reasons but it should not be used since they have been fully removed from ROBLOX for a couple of years now.
Either use Celery's httpget
or syn.request
.