started docs!
This commit is contained in:
35
content/docs/macros/MV_ENC_FUNC.md
Normal file
35
content/docs/macros/MV_ENC_FUNC.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
weight: 100
|
||||
title: "MV_ENC_FUNC"
|
||||
description: "Encrypts functions"
|
||||
icon: "article"
|
||||
date: "2025-05-01T18:47:58-05:00"
|
||||
lastmod: "2025-05-01T18:47:58-05:00"
|
||||
---
|
||||
|
||||
`declare function MV_ENC_FUNC<A..., R...>(vmFunction: (A...) -> R..., encryptKey: string, decryptKey: string): (A...) -> R...`
|
||||
|
||||
will virtualize and encrypt the passed function constant with the provided `encryptKey`. Then `decryptKey` is evaluated at runtime to grab the key.
|
||||
|
||||
## Valid Usage
|
||||
```lua
|
||||
local foo = 'ok'
|
||||
local total = 0
|
||||
|
||||
local getKey = MV_VM(function()
|
||||
-- WARNING: this is just an example! don't do this
|
||||
return "pass" .. "word123"
|
||||
end)
|
||||
|
||||
for i = 1, 10 do
|
||||
-- referenced upvalues will be captured
|
||||
MV_ENC_FUNC(function()
|
||||
print("in virtualized function # 1", i)
|
||||
total = total + i
|
||||
end, "password123", getKey())()
|
||||
end
|
||||
|
||||
return total
|
||||
```
|
||||
{{% alert context="warning" text="**Note**: if your plan doesn't include virtualization support, `MV_ENC_FUNC` is a no-op where the passed function is mangled normally and not virtualized or encrypted!" /%}}
|
||||
|
||||
21
content/docs/macros/MV_ENC_STR.md
Normal file
21
content/docs/macros/MV_ENC_STR.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
weight: 100
|
||||
title: "MV_ENC_STR"
|
||||
description: "Encrypts strings"
|
||||
icon: "article"
|
||||
date: "2025-05-01T18:47:58-05:00"
|
||||
lastmod: "2025-05-01T18:47:58-05:00"
|
||||
---
|
||||
|
||||
`declare function MV_ENC_STR(str: string, encryptKey: string, decryptKey: string): string`
|
||||
|
||||
will encrypt the passed string constant with the provided `encryptKey`. Then `decryptKey` is evaluated at runtime to grab the key.
|
||||
|
||||
## Valid Usage
|
||||
```lua
|
||||
local getKey = MV_VM(function()
|
||||
return "pass" .. "word123"
|
||||
end)
|
||||
|
||||
return MV_ENC_STR("hello world", "password123", getKey())
|
||||
```
|
||||
22
content/docs/macros/MV_INDEX_TO_NUM.md
Normal file
22
content/docs/macros/MV_INDEX_TO_NUM.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
weight: 100
|
||||
title: "MV_INDEX_TO_NUM"
|
||||
description: "Obfuscates named indexes"
|
||||
icon: "article"
|
||||
date: "2025-05-01T18:47:58-05:00"
|
||||
lastmod: "2025-05-01T18:47:58-05:00"
|
||||
---
|
||||
|
||||
`declare function MV_INDEX_TO_NUM(tbl: {}): {}`
|
||||
|
||||
will replace all instances of named indexes with a unique number constant.
|
||||
|
||||
## Valid Usage
|
||||
|
||||
```lua
|
||||
local foo = MV_INDEX_TO_NUM({total = 0})
|
||||
for i = 1, 10 do
|
||||
foo.total = foo.total + i
|
||||
end
|
||||
return foo.total
|
||||
```
|
||||
22
content/docs/macros/MV_OMIT_FUNCTION.md
Normal file
22
content/docs/macros/MV_OMIT_FUNCTION.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
weight: 100
|
||||
title: "MV_OMIT_FUNCTION"
|
||||
description: "Omit all mangling steps"
|
||||
icon: "article"
|
||||
date: "2025-05-01T18:47:58-05:00"
|
||||
lastmod: "2025-05-01T18:47:58-05:00"
|
||||
---
|
||||
|
||||
`declare function MV_OMIT_FUNCTION<A..., R...>(omit: (A...) -> R...): (A...) -> R...`
|
||||
|
||||
will omit all mangling steps from the passed function, will also disregard any indexes set by `MV_INDEX_TO_NUM`
|
||||
|
||||
## Valid Usage
|
||||
|
||||
```lua
|
||||
local dontMangleMe = MV_OMIT_FUNCTION(function()
|
||||
print("im in plaintext!")
|
||||
end)
|
||||
|
||||
donMangleMe()
|
||||
```
|
||||
23
content/docs/macros/MV_VM.md
Normal file
23
content/docs/macros/MV_VM.md
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
weight: 100
|
||||
title: "MV_VM"
|
||||
description: "Virtualize function"
|
||||
icon: "article"
|
||||
date: "2025-05-01T18:47:58-05:00"
|
||||
lastmod: "2025-05-01T18:47:58-05:00"
|
||||
---
|
||||
|
||||
`declare function MV_VM<A..., R...>(vmFunction: (A...) -> R...): (A...) -> R...`
|
||||
|
||||
will mark the passed function to be lifted into the VM.
|
||||
|
||||
## Valid Usage
|
||||
|
||||
```lua
|
||||
local virtualizedFunction = MV_VM(function(a, b, c)
|
||||
print(a .. b .. c .. " im in the vm!")
|
||||
end)
|
||||
|
||||
virtualizedFunction("1", "2", "3")
|
||||
```
|
||||
{{% alert context="info" text="**Note**: if your plan doesn't include virtualization support, `MV_VM` is a no-op where the passed function is mangled normally and not virtualized." /%}}
|
||||
8
content/docs/macros/_index.md
Normal file
8
content/docs/macros/_index.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
weight: 100
|
||||
title: "Macros"
|
||||
description: "Obfuscator API"
|
||||
icon: "article"
|
||||
date: "2025-05-01T18:47:58-05:00"
|
||||
lastmod: "2025-05-01T18:47:58-05:00"
|
||||
---
|
||||
Reference in New Issue
Block a user