Skip to content

Commit

Permalink
Add setfenv, getsynasset
Browse files Browse the repository at this point in the history
  • Loading branch information
richie0866 committed May 9, 2022
1 parent a61d0a4 commit 22f08be
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 26 deletions.
21 changes: 0 additions & 21 deletions types/RobloxScriptSecurity.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion types/core.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/// <reference types="@rbxts/types"/>
/// <reference types="@rbxts/types/plugin"/>
/// <reference path="Drawing.d.ts" />
/// <reference path="RobloxScriptSecurity.d.ts" />
/// <reference path="WebSocket.d.ts" />
/// <reference path="cache.d.ts" />
/// <reference path="closure.d.ts" />
Expand All @@ -14,4 +13,5 @@
/// <reference path="instance.d.ts" />
/// <reference path="metatable.d.ts" />
/// <reference path="misc.d.ts" />
/// <reference path="roblox.d.ts" />
/// <reference path="syn.d.ts" />
34 changes: 34 additions & 0 deletions types/roblox.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Sets the environment to be used by the given function. `fn` can be a Lua
* function or a number that specifies the function at that stack level: Level
* 1 is the function calling `setfenv`. `setfenv` returns the given function.
*
* As a special case, when `fn` is 0, setfenv changes the environment of the
* running thread. In this case, setfenv returns no values.
*
* @param fn A Lua function or the stack level.
* @param environment The new environment.
*/
declare function setfenv<T extends number | Callback>(fn: T, environment: object): T extends 0 ? undefined : T;

interface DataModel {
/**
* Sends a HTTP GET request to the given URL and returns the response body.
*/
HttpGetAsync(
this: DataModel,
url: string,
httpRequestType?: Enum.HttpRequestType,
): LuaTuple<[body: string, code: number]>;

/**
* Sends a POST request to the specified url, using the specified data and contentType.
*/
HttpPostAsync(
this: DataModel,
url: string,
data: string,
contentType?: string,
httpRequestType?: Enum.HttpRequestType,
): string;
}
15 changes: 11 additions & 4 deletions types/syn.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/// <reference path="cache.d.ts" />
/// <reference path="environment.d.ts" />
/// <reference path="misc.d.ts" />

// https://x.synapse.to/docs

declare namespace syn {
// Aliases
// Aliases

declare const getsynasset: typeof getcustomasset | undefined;

declare namespace syn {
const cache_replace: typeof cache.replace;
const cache_invalidate: typeof cache.invalidate;
const set_thread_identity: typeof setidentity;
Expand All @@ -14,9 +17,11 @@ declare namespace syn {
const write_clipboard: typeof setclipboard;
const queue_on_teleport: typeof queueonteleport;
const request: typeof http_request;
}

// Signatures
// Signatures

declare namespace syn {
function protect_gui(object: GuiObject): void;
function unprotect_gui(object: GuiObject): void;
function is_beta(): boolean;
Expand All @@ -34,9 +39,11 @@ declare namespace syn {
): ReturnType<T>;
function create_secure_function(code: string): Callback;
function run_secure_function<T = unknown>(code: string): T;
}

// Libraries
// Libraries

declare namespace syn {
namespace crypt {
namespace base64 {
function encode(data: string): string;
Expand Down

0 comments on commit 22f08be

Please sign in to comment.