From fab76f73caaa98291f479ff4d84ccb8db142b248 Mon Sep 17 00:00:00 2001 From: Stefan <42220813+Stefanuk12@users.noreply.github.com> Date: Wed, 1 May 2024 21:33:18 +0100 Subject: [PATCH 1/3] add luau types --- luraph.d.luau | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 luraph.d.luau 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 From 5b0f24f91c4b0f809b769b4519743766bc1dac8c Mon Sep 17 00:00:00 2001 From: Stefan <42220813+Stefanuk12@users.noreply.github.com> Date: Thu, 26 Dec 2024 17:03:20 +0000 Subject: [PATCH 2/3] make macros like LPH_NO_UPVALUES and LPH_CRASH work when not obfuscated --- luraphsdk.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/luraphsdk.lua b/luraphsdk.lua index 5fdd641..752769c 100644 --- a/luraphsdk.lua +++ b/luraphsdk.lua @@ -38,9 +38,26 @@ 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.") + game:Shutdown() + while true do end end From 96cca815b185633653483da99d5b3133d82af48c Mon Sep 17 00:00:00 2001 From: Stefan <42220813+Stefanuk12@users.noreply.github.com> Date: Thu, 5 Jun 2025 20:12:49 +0100 Subject: [PATCH 3/3] make compatible with other platforms --- luraphsdk.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/luraphsdk.lua b/luraphsdk.lua index 752769c..5a799b4 100644 --- a/luraphsdk.lua +++ b/luraphsdk.lua @@ -58,6 +58,5 @@ end LPH_CRASH = function(...) assert(#{...} == 0, "LPH_CRASH does not accept any arguments.") - game:Shutdown() while true do end end