lje.func
Function inspection, spoofing, and stealth utilities.
Functions
lje.func.spoof(spoof_fn, target_fn)
Makes target_fn appear as spoof_fn in debug introspection (e.g. debug.getinfo).
The spoof is recorded globally. Each function can only participate in one spoof relationship at a time.
Parameters
| Name | Type | Description |
|---|---|---|
spoof_fn | function | The Lua function whose debug info will be reported. Must be a Lua function, not a C function. |
target_fn | function | The function that will appear as |
Errors
Argument 1 must be a Lua function (not a C function).
lje.func.is_spoofed(fn)
Checks whether fn is currently being used as a spoof target.
Parameters
| Name | Type | Description |
|---|---|---|
fn | function | The function to check. |
Returns
| Type | Description |
|---|---|
boolean |
|
function? | If spoofed, the original function is also returned as a second value. |
lje.func.mark_special(fn)
Marks a Lua function as a special (internal) frame.
Special frames are hidden from stack introspection unless lje.env.show_special_frames is enabled. Automatically applied to callbacks registered with LJE (e.g. lje.util.set_push_string_callback).
Parameters
| Name | Type | Description |
|---|---|---|
fn | function | Must be a Lua function, not a C function. |
Errors
Argument 1 must be a Lua function (not a C function).
lje.func.compile(source)
Compiles a Lua string into a function without executing it. If a global environment is set via lje.env.set, it is applied to the compiled function automatically. Returns nil on compilation failure.
Parameters
| Name | Type | Description |
|---|---|---|
source | string | Lua source code to compile. |
Returns
| Type | Description |
|---|---|
function | nil | The compiled function, or |
lje.func.hide_caller(fn)
Hides fn from appearing as a caller in stack traces.
Parameters
| Name | Type | Description |
|---|---|---|
fn | function | The function to hide from stack traces. |
lje.func.type(fn)
Returns the internal LuaJIT fast function ID (ffid) of a function.
0means a Lua function1means a C function- Anything else is the unique ID of a fast function.
Parameters
| Name | Type | Description |
|---|---|---|
fn | function | The function to inspect. |
Returns
| Type | Description |
|---|---|
number | The |