Fix lag, FPS drops and crashes caused by obfuscation using LPH_NO_VIRTUALIZE
Luarmor uses Luraph as its obfuscation provider, so if you’re experiencing lag, FPS drops or even crashes, you need to use certain macros in your script. This page explains how to use the LPH_NO_VIRTUALIZE macro.
If your code runs fine unobfuscated but lags or crashes once obfuscated, this page explains why and how to fix it.
Why does obfuscation affect performance?
Luraph is a VM-based obfuscator: it turns your code into its own custom instructions, which are run by Luraph’s VM, which in turn is run by the Lua interpreter. This greatly increases the number of instruction cycles.
How obfuscation works
Normally, your script gets compiled into a set of Lua instructions. See the example below:
As you can see, your simple print statement gets compiled into 4 instructions. Each instruction is a cycle, so it will take 4 cycles to execute your code.When you obfuscate your script, the main goal is to make the original code unreadable. Luraph does this by generating its own custom instruction set that only the Luraph VM can understand.See the example below:
How Luraph obfuscates Lua code
Notice how your simple print statement turned into 40 instructions, which will take 40 cycles to execute. Also keep in mind that Luraph does a lot of things to obfuscate the code flow, which will ultimately lead to even more instructions.
Normally, Lua is extremely fast, so you will not notice any performance impact. But when your code runs hundreds of times per second, there will be obvious lag, FPS drops or even freezes while those instructions run.A good example is RenderStepped connections, which scripts often use to run their wallhack rendering every frame.
RenderStepped example
Example of a RenderStepped connection
This code will be slow when obfuscated, because the number of instructions generated by Luraph will be more than 2000. This means Lua will have to run 2000+ instruction cycles every frame, which is around 60 * 2000 = 120k instructions every second.This loop also calls local functions (e.g. CalculateParameters), which run every frame as well, adding even more instructions.
Here is a second example, a metamethod hook on __index:
__index example
Example of a metamethod hook
__index runs very often. For example, each of these invokes it:
game.Workspace
game.Players
and so on
Each one runs the hook code above, which is extremely resource intensive because the hook is probably called thousands of times per second.On top of that, if you obfuscate this part, you will end up with more than a million instructions to run every second, which will crash your game.
How to deal with this problem?
Do not wrap your entire script in LPH_NO_VIRTUALIZE, as it defeats the purpose of virtualization (obfuscation). Only use this macro if a function runs more than 30 times per second.
You need to exclude these frequently run functions from obfuscation, using either loadstring() or LPH_NO_VIRTUALIZE.We recommend LPH_NO_VIRTUALIZE over loadstring, because code excluded with LPH_NO_VIRTUALIZE is generally harder to view.
Where to use LPH_NO_VIRTUALIZE?
RenderStepped connections
Heartbeat connections
__index metamethod hooks
__namecall metamethod hooks (optional)
while true loops with no delay
GC scan loops
Functions called by any of the above
How to use LPH_NO_VIRTUALIZE?
LPH_NO_VIRTUALIZE takes one argument, which must be a constant function (written inline, not passed as a variable), and returns a function you can call.
Add this at the top of your script, so the original (unobfuscated) code still runs:
getfenv().LPH_NO_VIRTUALIZE = function(f) return f end;
This pattern works for any LPH macro. See Macros.Here are examples of good and bad usage of LPH_NO_VIRTUALIZE:
Good usage
RunService.RenderStepped(LPH_NO_VIRTUALIZE(function(s) -- regular function bodyend))
old = hookmetamethod(game, "__index", LPH_NO_VIRTUALIZE(function(t, k) -- regular function bodyend))
local generateTracers = LPH_NO_VIRTUALIZE(function(pos, pos2) -- function bodyend)RunService.Heartbeat:Connect(generateTracers)
LPH_NO_VIRTUALIZE(function() for i,v in pairs(getgc()) do if type(v) == 'table' then f = v end endend)()
Bad usage
local function doSomething()-- function bodyendLPH_NO_VIRTUALIZE(doSomething) -- you can't pass reference argumentshookfunction(print, doSomething)
LPH_NO_VIRTUALIZE( -- this is a syntax error local old old = hookmetamethod(game, "__namecall", function(...) end))
LPH_NO_VIRTUALIZE(function() -- somethingend) -- This part will not run because you are not calling it at the end.-- You should add an extra () at the end in order to call itprint('done')
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Luarmor","colors":{"primary":"#0D9373","light":"#07C983","dark":"#0D9373"},"logo":{"light":"https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/logo/dark.png?fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=b532049847f4a9deb56871da2e8ed09b","dark":"https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/logo/dark.png?fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=b532049847f4a9deb56871da2e8ed09b"},"favicon":"https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/favicon.png?fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=59eee2521a825ce26b8fdd9c8cca9353","api":{"openapi":"api-reference/openapi.json","mdx":{"auth":{"method":"key"},"server":"https://api.luarmor.net"}},"navbar":{"links":[{"href":"https://discord.gg/luarmor","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://luarmor.net/dashboard"}},"footer":{"socials":{"discord":"https://discord.gg/luarmor"}},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Website","icon":"globe","href":"https://luarmor.net"},{"anchor":"Discord","icon":"discord","href":"https://discord.gg/luarmor"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"luarmor","hasAudioNarration":false,"actualSubdomain":"luarmor","customDomains":[],"gitSource":{"type":"github","owner":"stefanuk12","repo":"luarmor","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6acabf572c846af6175b1786","clientVersion":"0.0.4160","searchFilterCounts":[{"language":"default","tag":"API Reference","count":16},{"language":"default","tag":"Documentation","count":15},{"language":"default","tag":"User Management","count":8},{"language":"default","tag":"Features","count":6},{"language":"default","tag":"Scripting","count":4},{"language":"default","tag":"API Management","count":3},{"language":"default","tag":"Help","count":3},{"language":"default","tag":"Script Management","count":2},{"language":"default","tag":"Getting Started","count":2},{"language":"default","tag":"Get Started","count":2}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"scripting/optimisation","slug":"/scripting/optimisation","pageMetadata":{"title":"Optimising Your Script","sidebarTitle":"Optimisation","description":"Fix lag, FPS drops and crashes caused by obfuscation using LPH_NO_VIRTUALIZE","href":"/scripting/optimisation"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Fix lag, FPS drops and crashes caused by obfuscation using LPH_NO_VIRTUALIZE\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,AccordionGroup,CodeBlock,CodeGroup,Frame,Heading,Note,OptimizedImage,Warning}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!AccordionGroup)_missingMdxReference(`AccordionGroup`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Luarmor uses `,_jsx(_components.a,{href:`https://luraph.com`,children:`Luraph`}),` as its obfuscation provider, so if you’re experiencing lag, FPS drops or even crashes, you need to use certain `,_jsx(_components.a,{href:`/scripting/macros`,children:`macros`}),` in your script. This page explains how to use the `,_jsx(_components.code,{children:`LPH_NO_VIRTUALIZE`}),` macro.`]}),`\n`,_jsx(Note,{children:_jsx(_components.p,{children:`If your code runs fine unobfuscated but lags or crashes once obfuscated, this page explains why and how to fix it.`})}),`\n`,_jsx(Heading,{level:`2`,id:`why-does-obfuscation-affect-performance`,children:`Why does obfuscation affect performance?`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.a,{href:`https://luraph.com`,children:`Luraph`}),` is a VM-based obfuscator: it turns your code into its own custom instructions, which are run by Luraph’s VM, which in turn is run by the Lua interpreter. This greatly increases the number of instruction cycles.`]}),`\n`,_jsxs(Accordion,{title:`How obfuscation works`,id:`how-obfuscation-works`,children:[_jsx(_components.p,{children:`Normally, your script gets compiled into a set of Lua instructions. See the example below:`}),_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`What you see`,numberOfLines:`1`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"hi\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`game`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`What the Lua interpreter sees`,numberOfLines:`5`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`GETGLOBAL 0 -1 ; print`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`LOADK 1 -2 ; \"hi\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`GETGLOBAL 2 -3 ; game`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`CALL 0 3 1`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})]}),_jsxs(_components.p,{children:[`As you can see, your simple `,_jsx(_components.code,{children:`print`}),` statement gets compiled into 4 instructions. Each instruction is a cycle, so it will take `,_jsx(_components.strong,{children:`4 cycles to execute your code`}),`.`]}),_jsx(_components.p,{children:`When you obfuscate your script, the main goal is to make the original code unreadable. Luraph does this by generating its own custom instruction set that only the Luraph VM can understand.`}),_jsx(_components.p,{children:`See the example below:`}),_jsx(Frame,{caption:`How Luraph obfuscates Lua code`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-2.png?fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=430f8a641c4435225441d6648a0f3693`,alt:`Side by side: a short piece of an obfuscated VM loop, and the 40 bytecode instructions it compiles to`,\"data-og-width\":`1328`,width:`1328`,\"data-og-height\":`529`,height:`529`,\"data-path\":`images/optimisation-2.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-2.png?w=280\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=ff7304b358415df16e6ea192dd248531 280w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-2.png?w=560\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=e501e4674c98e945b9194acb90b10133 560w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-2.png?w=840\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=dddb4ca17ee80a51e34de969dcff2c3e 840w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-2.png?w=1100\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=9a89e6771bf3a66c09cfade12c5143bd 1100w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-2.png?w=1650\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=b5962f3ad6e5af48ce39c1f24cc9d1c7 1650w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-2.png?w=2500\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=f2d34920f70429340b15e685b6b4e04b 2500w`})}),_jsxs(_components.p,{children:[`Notice how your simple `,_jsx(_components.code,{children:`print`}),` statement turned into 40 instructions, which will take `,_jsx(_components.strong,{children:`40 cycles to execute`}),`. Also keep in mind that Luraph does a lot of things to obfuscate the code flow, which will ultimately lead to `,_jsx(_components.em,{children:`even more instructions`}),`.`]})]}),`\n`,_jsxs(_components.p,{children:[`Normally, Lua is extremely fast, so you `,_jsx(_components.strong,{children:`will not notice`}),` any performance impact. But when your code runs `,_jsx(_components.strong,{children:`hundreds of times per second`}),`, there will be obvious lag, FPS drops or even freezes while those instructions run.`]}),`\n`,_jsxs(_components.p,{children:[`A good example is `,_jsx(_components.code,{children:`RenderStepped`}),` connections, which scripts often use to run their wallhack rendering every frame.`]}),`\n`,_jsxs(Accordion,{title:`RenderStepped example`,id:`renderstepped-example`,children:[_jsx(Frame,{caption:`Example of a RenderStepped connection`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-3.png?fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=93cb5c82662bcf10de4238ad39b82989`,alt:`A RenderStepped connection that runs 60+ times a second and updates a tracer's render properties every frame`,\"data-og-width\":`891`,width:`891`,\"data-og-height\":`488`,height:`488`,\"data-path\":`images/optimisation-3.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-3.png?w=280\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=6fe3f53e7ac087b96694925310cd8eb3 280w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-3.png?w=560\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=7f1555fd11d5e889324b767770e90d7b 560w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-3.png?w=840\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=e3a9050daf22786f75cd0ba03c23b05b 840w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-3.png?w=1100\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=cbf813c2b6cc250e3c9c671824ef4144 1100w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-3.png?w=1650\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=9d71b559965cdb923d5140149f006151 1650w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-3.png?w=2500\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=be5185bade7f4acb948d0357c2275f66 2500w`})}),_jsxs(_components.p,{children:[`This code will be slow when obfuscated, because the number of instructions generated by Luraph will be more than `,_jsx(_components.em,{children:`2000`}),`. This means Lua will have to run `,_jsx(_components.strong,{children:`2000+ instruction cycles every frame`}),`, which is around `,_jsx(_components.strong,{children:`60 * 2000 = 120k`}),` instructions every second.`]}),_jsxs(_components.p,{children:[`This loop also calls local functions (e.g. `,_jsx(_components.code,{children:`CalculateParameters`}),`), which run every frame as well, adding `,_jsx(_components.em,{children:`even more instructions`}),`.`]})]}),`\n`,_jsxs(_components.p,{children:[`Here is a second example, a metamethod hook on `,_jsx(_components.code,{children:`__index`}),`:`]}),`\n`,_jsxs(Accordion,{title:`__index example`,id:`index-example`,children:[_jsx(Frame,{caption:`Example of a metamethod hook`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-4.png?fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=92c4a21b0b99f178a13d70fee1787e26`,alt:`An __index metamethod hook on game that runs every time any property is read, used here to redirect mouse targeting`,\"data-og-width\":`941`,width:`941`,\"data-og-height\":`543`,height:`543`,\"data-path\":`images/optimisation-4.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-4.png?w=280\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=9b32b9938ad98a6e156ab01e02c1568e 280w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-4.png?w=560\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=e15ce64b063a3954ff6b9b89da21aebb 560w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-4.png?w=840\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=b233e49062d3462a4467412f12ace61e 840w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-4.png?w=1100\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=acadb5fb96bd5e4f8502888ed0d6c150 1100w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-4.png?w=1650\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=89fc82b2fa9601d3592ca4272609c33a 1650w, https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/images/optimisation-4.png?w=2500\u0026fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=52929678fb85e67bf056a6f870974232 2500w`})}),_jsxs(_components.p,{children:[_jsx(_components.code,{children:`__index`}),` runs very often. For example, each of these invokes it:`]}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`game.Workspace`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`game.Players`})}),`\n`,_jsx(_components.li,{children:`and so on`}),`\n`]}),_jsxs(_components.p,{children:[`Each one runs the hook code above, which is extremely resource intensive because the hook is probably called `,_jsx(_components.strong,{children:`thousands of times per second`}),`.`]}),_jsxs(_components.p,{children:[`On top of that, `,_jsx(_components.strong,{children:`if you obfuscate this part`}),`, you will end up with `,_jsx(_components.strong,{children:`more than a million`}),` instructions to run every second, which will crash your game.`]})]}),`\n`,_jsx(Heading,{level:`2`,id:`how-to-deal-with-this-problem`,children:`How to deal with this problem?`}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Do not`}),` wrap your entire script in `,_jsx(_components.code,{children:`LPH_NO_VIRTUALIZE`}),`, as it defeats the purpose of virtualization (obfuscation). Only use this macro if a function runs more than 30 times per second.`]})}),`\n`,_jsxs(_components.p,{children:[`You need to exclude these frequently run functions from obfuscation, using either `,_jsx(_components.code,{children:`loadstring()`}),` or `,_jsx(_components.code,{children:`LPH_NO_VIRTUALIZE`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`We recommend `,_jsx(_components.code,{children:`LPH_NO_VIRTUALIZE`}),` over `,_jsx(_components.code,{children:`loadstring`}),`, because code excluded with `,_jsx(_components.code,{children:`LPH_NO_VIRTUALIZE`}),` is generally harder to view.`]}),`\n`,_jsxs(Heading,{level:`2`,id:`where-to-use-lph_no_virtualize`,children:[`Where to use `,_jsx(_components.code,{children:`LPH_NO_VIRTUALIZE`}),`?`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`RenderStepped`}),` connections`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`Heartbeat`}),` connections`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`__index`}),` metamethod hooks`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`__namecall`}),` metamethod hooks (optional)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`while true`}),` loops with no delay`]}),`\n`,_jsx(_components.li,{children:`GC scan loops`}),`\n`,_jsx(_components.li,{children:`Functions called by any of the above`}),`\n`]}),`\n`,_jsxs(Heading,{level:`2`,id:`how-to-use-lph_no_virtualize`,children:[`How to use `,_jsx(_components.code,{children:`LPH_NO_VIRTUALIZE`}),`?`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`LPH_NO_VIRTUALIZE`}),` takes one argument, which must be a constant function (written inline, not passed as a variable), and returns a function you can call.`]}),`\n`,_jsxs(Warning,{children:[_jsx(_components.p,{children:`Add this at the top of your script, so the original (unobfuscated) code still runs:`}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`getfenv`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`LPH_NO_VIRTUALIZE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`f`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` f`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})})]}),`\n`,_jsxs(_components.p,{children:[`This pattern works for any LPH macro. See `,_jsx(_components.a,{href:`/scripting/macros`,children:`Macros`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`Here are examples of good and bad usage of `,_jsx(_components.code,{children:`LPH_NO_VIRTUALIZE`}),`:`]}),`\n`,_jsxs(AccordionGroup,{children:[_jsxs(Accordion,{title:`Good usage`,id:`good-usage`,children:[_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`RunService`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`RenderStepped`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`LPH_NO_VIRTUALIZE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`s`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- regular function body`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`old`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` hookmetamethod`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`game`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"__index\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`LPH_NO_VIRTUALIZE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`t`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`k`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- regular function body`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`local`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` generateTracers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` LPH_NO_VIRTUALIZE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`pos`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`pos2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- function body`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`RunService`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Heartbeat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`Connect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`generateTracers`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`LPH_NO_VIRTUALIZE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` i`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`v`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` in`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` pairs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`getgc`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`do`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`v`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'table' `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`then`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` f`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` v`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` end`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` end`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)()`})]}),`\n`]})})})]}),_jsxs(Accordion,{title:`Bad usage`,id:`bad-usage`,children:[_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`local`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` doSomething`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- function body`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`LPH_NO_VIRTUALIZE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`doSomething`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- you can't pass reference arguments`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`hookfunction`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`doSomething`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`LPH_NO_VIRTUALIZE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`( `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- this is a syntax error`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` local`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` old`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` old`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` hookmetamethod`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`game`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"__namecall\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(...) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`LPH_NO_VIRTUALIZE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- something`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- This part will not run because you are not calling it at the end.`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- You should add an extra () at the end in order to call it`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'done'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Optimising Your Script","sidebarTitle":"Optimisation","description":"Fix lag, FPS drops and crashes caused by obfuscation using LPH_NO_VIRTUALIZE","href":"/scripting/optimisation"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Why does obfuscation affect performance?","slug":"why-does-obfuscation-affect-performance","depth":2,"children":[]},{"title":"How to deal with this problem?","slug":"how-to-deal-with-this-problem","depth":2,"children":[]},{"title":"Where to use LPH_NO_VIRTUALIZE?","slug":"where-to-use-lph_no_virtualize","depth":2,"children":[]},{"title":"How to use LPH_NO_VIRTUALIZE?","slug":"how-to-use-lph_no_virtualize","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"luarmor","siteName":"Luarmor","title":"Optimising Your Script - Luarmor","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-10T22:19:16.946Z","originalFileLocation":"scripting/optimisation.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Fix lag, FPS drops and crashes caused by obfuscation using LPH_NO_VIRTUALIZE\">\u003cmeta data-mint-head name=\"application-name\" content=\"Luarmor\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/luarmor/jQx-9jqXEra01BCa/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/luarmor/jQx-9jqXEra01BCa/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/luarmor/jQx-9jqXEra01BCa/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/luarmor/jQx-9jqXEra01BCa/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/luarmor/jQx-9jqXEra01BCa/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/luarmor/jQx-9jqXEra01BCa/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/luarmor/jQx-9jqXEra01BCa/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/luarmor/jQx-9jqXEra01BCa/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/luarmor/jQx-9jqXEra01BCa/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Optimising Your Script - Luarmor\">\u003cmeta data-mint-head property=\"og:description\" content=\"Fix lag, FPS drops and crashes caused by obfuscation using LPH_NO_VIRTUALIZE\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Luarmor\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://luarmor.mintlify.app/scripting/optimisation\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://luarmor.mintlify.site/_mintlify/api/og/v2?division=Scripting\u0026amp;title=Optimising+Your+Script\u0026amp;description=Fix+lag%2C+FPS+drops+and+crashes+caused+by+obfuscation+using+LPH_NO_VIRTUALIZE\u0026amp;theme=d7efb2fecdca69b72ec616b1\u0026amp;signature=7f7eb13e7446088cf60eafd835158ff1f81a8b199291c8f974de8fc227552331\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Optimising Your Script - Luarmor\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Fix lag, FPS drops and crashes caused by obfuscation using LPH_NO_VIRTUALIZE\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://luarmor.mintlify.site/_mintlify/api/og/v2?division=Scripting\u0026amp;title=Optimising+Your+Script\u0026amp;description=Fix+lag%2C+FPS+drops+and+crashes+caused+by+obfuscation+using+LPH_NO_VIRTUALIZE\u0026amp;theme=d7efb2fecdca69b72ec616b1\u0026amp;signature=7f7eb13e7446088cf60eafd835158ff1f81a8b199291c8f974de8fc227552331\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/luarmor/jQx-9jqXEra01BCa/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Luarmor\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0D9373\">\u003clink data-mint-head rel=\"canonical\" href=\"https://luarmor.mintlify.app/scripting/optimisation\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/scripting/optimisation.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://luarmor.mintlify.app/#organization\",\"name\":\"Luarmor\",\"url\":\"https://luarmor.mintlify.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/luarmor/8pPKYh_Y132D2Y4u/logo/dark.png?fit=max\u0026auto=format\u0026n=8pPKYh_Y132D2Y4u\u0026q=85\u0026s=b532049847f4a9deb56871da2e8ed09b\"}},{\"@type\":\"WebSite\",\"@id\":\"https://luarmor.mintlify.app#website\",\"name\":\"Luarmor\",\"url\":\"https://luarmor.mintlify.app\",\"publisher\":{\"@id\":\"https://luarmor.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://luarmor.mintlify.app/scripting/optimisation#webpage\",\"url\":\"https://luarmor.mintlify.app/scripting/optimisation\",\"name\":\"Optimising Your Script\",\"description\":\"Fix lag, FPS drops and crashes caused by obfuscation using LPH_NO_VIRTUALIZE\",\"dateModified\":\"2026-10-10T22:19:16.946Z\",\"isPartOf\":{\"@id\":\"https://luarmor.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://luarmor.mintlify.app/scripting/optimisation#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://luarmor.mintlify.app/scripting/optimisation#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Luarmor\",\"item\":\"https://luarmor.mintlify.app\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Optimising Your Script\",\"item\":\"https://luarmor.mintlify.app/scripting/optimisation\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://luarmor.mintlify.app/scripting/optimisation#article\",\"headline\":\"Optimising Your Script\",\"name\":\"Optimising Your Script\",\"description\":\"Fix lag, FPS drops and crashes caused by obfuscation using LPH_NO_VIRTUALIZE\",\"url\":\"https://luarmor.mintlify.app/scripting/optimisation\",\"mainEntityOfPage\":{\"@id\":\"https://luarmor.mintlify.app/scripting/optimisation#webpage\"},\"dateModified\":\"2026-10-10T22:19:16.946Z\",\"publisher\":{\"@id\":\"https://luarmor.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://luarmor.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Luarmor\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Luarmor\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/scripting/optimisation.md","siteName":"Luarmor","nav":{"global":{"anchors":[{"anchor":"Website","icon":"globe","href":"https://luarmor.net"},{"anchor":"Discord","icon":"discord","href":"https://discord.gg/luarmor"}]},"tabs":[{"tab":"Documentation","groups":[{"group":"Get Started","pages":[{"title":"Introduction","href":"/introduction"},{"title":"Quickstart","href":"/quickstart"}]},{"group":"Features","pages":[{"title":"Discord Bot","href":"/discord-bot"},{"title":"Ad Rewards","href":"/features/ad-rewards"},{"title":"Anti-Bypass Policy","href":"/features/anti-bypass-policy"},{"title":"Webhook Protection","href":"/features/webhook-protection"},{"title":"Source Locker","href":"/features/source-locker"},{"title":"Verified Scripts","description":"Discontinued. What the verified badge meant and how it worked, kept for reference","tag":"Discontinued","href":"/scripting/verification"}]},{"group":"Scripting","pages":[{"title":"Optimising Your Script","sidebarTitle":"Optimisation","href":"/scripting/optimisation"},{"title":"Macros","description":"Luraph and Luarmor macros you can use in your script, including LRM_INIT_SCRIPT","href":"/scripting/macros"},{"title":"Runtime Variables","href":"/scripting/runtime-vars"},{"title":"Key Check Library","href":"/scripting/key-check-library"}]},{"group":"Help","pages":[{"title":"Troubleshooting for Script Users","sidebarTitle":"Script Users","href":"/troubleshooting/script-users"},{"title":"Troubleshooting for Script Owners","sidebarTitle":"Script Owners","href":"/troubleshooting/script-owners"},{"title":"Identifying Common Scams","sidebarTitle":"Common Scams","href":"/troubleshooting/common-scams"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/introduction"}]}]},"basePath":"","title":"Optimising Your Script - Luarmor","buildId":"dpl_GRSyrvXT6FFTpZZTGz5iZPp3D2zE","deploymentId":"dpl_GRSyrvXT6FFTpZZTGz5iZPp3D2zE","dynamics":["07c022d89b","a74be98ba7"],"chunks":["Frame-RDXR0lmt.js","DynamicMarkdown-Z_y464fM.js","zoom-image-lightbox-D5uLWhtj.js","lightbox-handle-r17bVUz3.js"]}