I Sure Do Love Not Using Local Variables!

I Sure Do Love Not Using Local Variables!
lua-memes, roblox-memes, code-quality-memes, bad-code-memes, local-variables-memes | ProgrammerHumor.io

Someone wrote code so deeply nested in getfenv() calls that it looks like they're allergic to storing values in variables. Every single line chains together getfenv().game.ServerScriptService.data[plr] like they're being paid per character typed.

Instead of doing the sane thing and writing local playerData = getfenv().game.ServerScriptService.data[plr] once at the top, they decided to traverse the entire object hierarchy on every. single. line. The performance implications alone are making my CPU cry. It's like watching someone walk to the grocery store and back for each individual ingredient instead of just... buying everything at once.

The irony? They're clearly working in a Roblox/Lua environment where local variables are basically free and would make this code 10x more readable and performant. But nope, let's just spam getfenv() like it's going out of style and create a maintenance nightmare that would make any code reviewer weep.

More Like This