> ## Documentation Index
> Fetch the complete documentation index at: https://eco-804c21df.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Closure Functions

> Functions related to closure.

### Get Script Closure

```lua theme={null}
getscriptclosure(Script: LuaSourceContainer) : () -> () <function>
```

<Info>
  getscriptclosure, getscriptfunction
</Info>

Returns the script as a function (Basically it's just a script code wrapped in a function)

### Get Script Bytecode

```lua theme={null}
getscriptbytecode(Script: LocalScript) : ScriptBytecode <string>
```

<Info>
  getscriptbytecode
</Info>

Returns the script bytecode, which later can be converted into a function by using `loadbytecode`

### Load Bytecode

```lua theme={null}
loadbytecode(ScriptBytecode: string) : () -> () <function>
```

<Info>
  loadbytecode
</Info>

<Warning>
  **Eco Executor** exclusive.
</Warning>

Converts the `ScriptBytecode` into a function.

### New C Closure

```lua theme={null}
newcclosure(func: () -> ()) : Cclosure <function>
```

<Info>
  newcclosure, new\_c\_closure
</Info>

Wraps the given `func` as a C closure, converting it from L closure to a C closure.

### New L Closure

```lua theme={null}
newlclosure(func: () -> ()) : Lclosure <function>
```

<Info>
  newlclosure, new\_l\_closure
</Info>

Just wraps the given `func` as a L closure.

### Is C Closure

```lua theme={null}
iscclosure(CClosure: () -> ()) : bool <boolean>
```

<Info>
  iscclosure, is\_c\_closure
</Info>

Checks the `CClosure` if it's a C closure or not, then returns a boolean.

### Is L Closure

```lua theme={null}
islclosure(LClosure: () -> ()) : bool <boolean>
```

<Info>
  islclosure, is\_l\_closure
</Info>

Checks the `LClosure` if it's a L closure or not, then returns a boolean.

### Dump String

```lua theme={null}
dumpstring(source: string | number | function) : DumpedString <string>
```

<Info>
  dumpstring
</Info>

Converts the `source` into a string.

### Loadstring

```lua theme={null}
loadstring(CodeString: string) : () -> () <function>
```

<Info>
  loadstring
</Info>

<Note>
  This loadstring has been modified by eAPI.
</Note>

Loads the given `CodeString` into a function and returns it.

### Check Caller

```lua theme={null}
checkcaller() : bool <boolean>
```

<Info>
  checkcaller, issynapsethread
</Info>

Checks if the caller is the executor and returns it as a boolean.

### Check Call Stack

```lua theme={null}
checkcallstack() : bool <boolean>
```

<Info>
  checkcallstack
</Info>

Pretty much the same as `checkcaller`.

### Get Calling Script

```lua theme={null}
getcallingscript() : CallingScript <Script>
```

<Info>
  getcallingscript, get\_calling\_script
</Info>

Gets the script that called the function.

### Clone Function

```lua theme={null}
clonefunction(func: () -> ()) : ClonedFunction <function>
```

<Info>
  clonefunction, clonefunc, cloneclosure
</Info>

Clones the function differently.

### Is Executor Closure

```lua theme={null}
isexecutorclosure(func: () -> ()) : bool <boolean>
```

<Info>
  isexecutorclosure, checkclosure, isourclosure, isexecclosure, isexeclosure, is\_executor\_closure, issynapsefunction
</Info>

Checks if the closure is from the executor.

### Decompile

```lua theme={null}
decompile(Target: Script) : DecompiledScript <string>
```

<Info>
  decompile
</Info>

Decompile the scripts into a string of code (code from the script) And then returns it.

### Bytecode To Lua

```lua theme={null}
bytecode_to_lua(source: () -> () | string | number | Script) : Decompiled <table>
```

<Info>
  byte\_to\_lua
</Info>

Decomp the `source` into a table.

### Dump Function

```lua theme={null}
dump_function(func: () -> ()) : DumpedFunction <string>
```

<Info>
  dump\_function, dumpfunction, dumpfunc, dump\_func, dumpf, dump\_f
</Info>

Dump function into a string.

### Protect Function

```lua theme={null}
protectfunction(func: () -> ()) : ProtectedFunction <function>
```

<Info>
  protectfunction, protect\_function, protectfunc
</Info>

Protects a function; when called, the script calling the protected function won't be a caller.
