Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions luraph.d.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type GenericFunction<T, U...> = (U...) -> T

declare function LPH_ENCFUNC<T, U...>(toEncrypt: GenericFunction<T, U...>, encKey: string, decKey: string): GenericFunction<T, U...>
declare function LPH_ENCSTR(toEncrypt: string): string
declare function LPH_ENCNUM(toEncrypt: number): number
declare function LPH_CRASH(): never
declare function LPH_JIT<T, U...>(toEnchance: GenericFunction<T, U...>): GenericFunction<T, U...>
declare function LPH_NO_VIRTUALIZE<T, U...>(toDevirtualize: GenericFunction<T, U...>): GenericFunction<T, U...>
declare function LPH_NO_UPVALUES<T, U...>(toFix: GenericFunction<T, U...>): GenericFunction<T, U...>
declare LPH_OBFUSCATED: boolean
18 changes: 17 additions & 1 deletion luraphsdk.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,25 @@ end
LPH_NO_UPVALUES = function(f, ...)
assert(type(setfenv) == "function", "LPH_NO_UPVALUES can only be used on Lua versions with getfenv & setfenv")
assert(type(f) == "function" and #{...} == 0, "LPH_NO_UPVALUES only accepts a single constant function as an argument.")
return f

local env = getrenv()
return setfenv(
LPH_NO_VIRTUALIZE(function(...)
return func(...)
end),
setmetatable(
{
func = f
},
{
__index = env,
__newindex = env
}
)
)
end

LPH_CRASH = function(...)
assert(#{...} == 0, "LPH_CRASH does not accept any arguments.")
while true do end
end