Compare commits
4 Commits
0b2fc6f495
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 761953e518 | |||
| c00cf12b71 | |||
| ca94e59b53 | |||
| 1adfca2a9f |
@@ -13,18 +13,18 @@ Many of Luraph's macros do features or optimizations that are already built into
|
|||||||
|
|
||||||
{{% table %}}
|
{{% table %}}
|
||||||
|
|
||||||
| Luraph Macro | MoonVeil Alias |
|
| Luraph Macro | MoonVeil Alias | Description |
|
||||||
| ----- | ----- |
|
| ----- | ----- | ----- |
|
||||||
| `LPH_ENCFUNC` | `MV_ENC_FUNC` |
|
| `LPH_ENCFUNC` | [MV_ENC_FUNC](/docs/macros/mv_enc_func) | Virtualizes and encrypts functions |
|
||||||
| `LPH_ENCSTR` | `MV_COMPRESS` |
|
| `LPH_ENCSTR` | `MV_NO_OP` | Not applicable |
|
||||||
| `LPH_ENCNUM` | `MV_NO_OP` |
|
| `LPH_ENCNUM` | `MV_NO_OP` | Not applicable |
|
||||||
| `LPH_CRASH` | `MV_CRASH` |
|
| `LPH_CRASH` | [MV_CRASH](/docs/macros/mv_crash) | Crashes the VM |
|
||||||
| `LPH_NO_VIRTUALIZE` | `MV_OMIT` |
|
| `LPH_NO_VIRTUALIZE` | [MV_OMIT](/docs/macros/mv_omit) | Omits a function from all obfuscation steps |
|
||||||
| `LPH_JIT` | `MV_NO_OP` |
|
| `LPH_JIT` | `MV_NO_OP` | MoonVeil provides built-in optimizations |
|
||||||
| `LPH_JIT_MAX` | `MV_NO_OP` |
|
| `LPH_JIT_MAX` | `MV_NO_OP` | MoonVeil provides built-in optimizations |
|
||||||
| `LPH_NO_UPVALUES` | `MV_NO_OP` |
|
| `LPH_NO_UPVALUES` | `MV_NO_OP` | Not applicable |
|
||||||
| `LPH_LINE` | `MV_LINE` |
|
| `LPH_LINE` | [MV_LINE](/docs/macros/mv_line) | Current line number |
|
||||||
| `LPH_OBFUSCATED` | `MV_OBFUSCATED` |
|
| `LPH_OBFUSCATED` | [MV_OBFUSCATED](/docs/macros/mv_obfuscated) | Detects obfuscation |
|
||||||
|
|
||||||
{{% /table %}}
|
{{% /table %}}
|
||||||
{{% alert context="info" text="`MV_NO_OP` isn't user accessible, and is only used to provide source compatibility." /%}}
|
{{% alert context="info" text="`MV_NO_OP` isn't user accessible, and is only used to provide source compatibility." /%}}
|
||||||
|
|||||||
@@ -16,6 +16,23 @@ Some limitations apply:
|
|||||||
- The passed function cannot tailcall or otherwise recursively call itself.
|
- The passed function cannot tailcall or otherwise recursively call itself.
|
||||||
- You must use this macro in it's specific form, i.e. `local <var> = MV_INLINE(function() ... end)`
|
- You must use this macro in it's specific form, i.e. `local <var> = MV_INLINE(function() ... end)`
|
||||||
|
|
||||||
|
Note that this pass acts more like a preprocessor that replaces the function calls with the results of the function (if any), and can have strange effects in some cases.
|
||||||
|
|
||||||
|
For example, when an inlined function is called, its function body is inserted right before the statement the call is in. This can lead to some unexpected behavior when used in `or` or `if` expressions:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local called = false
|
||||||
|
local testFunc = MV_INLINE(function()
|
||||||
|
called = true
|
||||||
|
return 'hi'
|
||||||
|
end)
|
||||||
|
|
||||||
|
local foo = 'bar' or testFunc()
|
||||||
|
print(foo, called)
|
||||||
|
```
|
||||||
|
|
||||||
|
Will print `bar true`, where under normal circumstances testFunc should not be executed. This is because the `or` expression is evaluated after the inserted body.
|
||||||
|
|
||||||
## Valid Usage
|
## Valid Usage
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ local a = MV_LINE
|
|||||||
print(a, MV_LINE)
|
print(a, MV_LINE)
|
||||||
```
|
```
|
||||||
|
|
||||||
Obfuscates to:
|
turns into:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
print(1,2)
|
print(1,2)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ end
|
|||||||
return if MV_OBFUSCATED then runWithoutDebugging() else runWithDebugging()
|
return if MV_OBFUSCATED then runWithoutDebugging() else runWithDebugging()
|
||||||
```
|
```
|
||||||
|
|
||||||
Obfuscates to:
|
turns into:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ lastmod: "2025-05-01T18:47:58-05:00"
|
|||||||
|
|
||||||
`declare function MV_OMIT(omit: any): any`
|
`declare function MV_OMIT(omit: any): any`
|
||||||
|
|
||||||
will omit all mangling steps from the passed expression, will also disregard any indexes set by `MV_INDEX_TO_NUM`. Passing a function to this can be useful to keep performance-critical sections unobfuscated.
|
will omit all obfuscation steps from the passed expression, will also disregard any indexes set by `MV_INDEX_TO_NUM`. Passing a function to this can be useful to keep performance-critical sections unobfuscated.
|
||||||
|
|
||||||
When used in a virtualized block (using the [MV_VM](./MV_VM) or [MV_ENC_FUNC](./MV_ENC_FUNC) macros), this will lift the function from the virtualized block as a separate standalone minified function in plaintext.
|
When used in a virtualized block (using the [MV_VM](./MV_VM) or [MV_ENC_FUNC](./MV_ENC_FUNC) macros), this will lift the function from the virtualized block as a separate standalone minified function in plaintext.
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ lastmod: "2025-05-01T18:47:58-05:00"
|
|||||||
|
|
||||||
MoonVeil provides multiple solutions to improve and optimize the performance of your scripts.
|
MoonVeil provides multiple solutions to improve and optimize the performance of your scripts.
|
||||||
|
|
||||||
## Using the 'Fast VM' option
|
## Using the 'Fast VM' preset
|
||||||
|
|
||||||
This preset is available in [your dashboard's settings](/docs/dashboard/). If you're still having performance issues, continue reading.
|
This preset is available in [your dashboard's settings](/docs/dashboard/). If you're still having performance issues, continue reading.
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ This preset is available in [your dashboard's settings](/docs/dashboard/). If yo
|
|||||||
|
|
||||||
Not all code needs to be obfuscated. Large libraries that deal with unimportant code such as UI libraries, data serialization libraries, etc. can be left unobfuscated.
|
Not all code needs to be obfuscated. Large libraries that deal with unimportant code such as UI libraries, data serialization libraries, etc. can be left unobfuscated.
|
||||||
|
|
||||||
MoonVeil allows you to omit obfuscation from specific blocks of your script, by wrapping the block in an `MV_OMIT` macro:
|
MoonVeil allows you to omit obfuscation from specific blocks of your script, by wrapping the block in an [MV_OMIT](/docs/macros/mv_omit_function) macro:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
MV_OMIT(function()
|
MV_OMIT(function()
|
||||||
@@ -38,7 +38,7 @@ end))
|
|||||||
|
|
||||||
## Obfuscation only through macros
|
## Obfuscation only through macros
|
||||||
|
|
||||||
Who says you need to obfuscate your whole script? If you know what you're doing, you can selectively tell MoonVeil to **only** obfuscate certain parts of your script using the `MV_VM`, `MV_ENC_FUNC` and `MV_CFF` macros. This gives you much more control over the obfuscation process, you simply tell MoonVeil what parts of your script you want to obfuscate:
|
Who says you need to obfuscate your whole script? If you know what you're doing, you can selectively tell MoonVeil to **only** obfuscate certain parts of your script using the [MV_VM](/docs/macros/mv_vm), [MV_ENC_FUNC](/docs/macros/mv_enc_func), and [MV_CFF](/docs/macros/mv_cff) macros. This gives you much more control over the obfuscation process, you simply tell MoonVeil what parts of your script you want to obfuscate:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local getThing = MV_VM(function()
|
local getThing = MV_VM(function()
|
||||||
|
|||||||
Reference in New Issue
Block a user