diff --git a/luraph.d.luau b/luraph.d.luau new file mode 100644 index 0000000..e2a9d63 --- /dev/null +++ b/luraph.d.luau @@ -0,0 +1,10 @@ +type GenericFunction = (U...) -> T + +declare function LPH_ENCFUNC(toEncrypt: GenericFunction, encKey: string, decKey: string): GenericFunction +declare function LPH_ENCSTR(toEncrypt: string): string +declare function LPH_ENCNUM(toEncrypt: number): number +declare function LPH_CRASH(): never +declare function LPH_JIT(toEnchance: GenericFunction): GenericFunction +declare function LPH_NO_VIRTUALIZE(toDevirtualize: GenericFunction): GenericFunction +declare function LPH_NO_UPVALUES(toFix: GenericFunction): GenericFunction +declare LPH_OBFUSCATED: boolean \ No newline at end of file diff --git a/luraphsdk.lua b/luraphsdk.lua index 5fdd641..5a799b4 100644 --- a/luraphsdk.lua +++ b/luraphsdk.lua @@ -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