loadstring(game:HttpGetAsync('https://raw.githubusercontent.com/strsplspace/utils/main/cenv.lua'))();
<table> getprotoclosures(<LocalScript>);
Returns the protos of LocalScript
<function> searchclosureconst(<any> Constants);
Returns the function that contains Constants
Example of usage
LocalScript contains this code:
spawn(function()
spawn(function() --We need to get this function
print('a');
warn('b');
end);
end);
Our code:
local Fn = searchclosureconst('print','a','warn','b');
print(Fn);
This function now generates code after use, then the code gets copied into clipboard
--Code generated by cenv
local Function;
local Consts = {
["1"] = "print",
["2"] = "a",
["3"] = "warn",
["4"] = "b"
};
for i,v in next,getgc(true) do
if (type(v) == 'function' and islclosure(v) and not is_synapse_function(v)) then
for i2,v2 in next,Consts do
if table.find(debug.getconstants(v),v2) then
Function = v;
end;
end;
end;
end;
<function> searchclosureups(<any> Upvalues);
Works same as searchclosureconst
but with Upvalues
<table> gcsenv(<LocalScript>);
Works same as regular getsenv
but uses gc instead, it can be useful if function in a table, regular getsenv
doesn't going to return that function
<table> getscriptlocals(<LocalScript>,<Optional> Iterations);
Returns the NON Upvalue variables of script, by default Iterations = 400
<boolean> cenv.Test(<void>);
The compatability function
cenv.GetFunctions(<void>);
Prints all functions in Synapse console, that are supported
<string> cenv.Find(<string> Function name);
Returns the name of function if finds it
cenv.Copy = <boolean>
Responsible for copying in SG.Generate,by default its true
This project can contain bugs, if you found one make a pull request.