Trying to make my asset handler more efficient any tips?

For some reason this module will lock the parent of a non-existant part yet it is not made to do it
EDIT: basically it won’t allow me to clone through the module anymore.
Code:

local Con = require(script.Parent);
local Service = Con.Service;
local RS = Service.ReplicatedStorage;
local Assets = RS.Assets;
return setmetatable({}, {
	__index	= function(This, Name)
		local A = Assets('FindFirstChild',Name);
		if A then
			local R = A:Clone();
			This[Name] = R;
			return R;
			else
			error('Invalid dependency name.', 2);
		end;
	end;
})

:thinking:

local Con = require(script.Parent)
local Service = Con.Service
local RS = Service.ReplicatedStorage
local Assets = RS.Assets
return setmetatable({}, {
	__index	= function(This, Name)
		local A = Assets('FindFirstChild',Name)
		if A then
			local R = A:Clone()
			This[Name] = R
			return R
			else
			error('Invalid dependency name.', 2)
		end
	end
})

That should save you a few characters.

1 Like

cringe
You activated my ocd

Lowkey ptsd flashbacks of Converse tho.

Err wait is that my ages old code?

Kudos on keeping the calling convention but sadly the staff have said it has no guarantee of still being supported.

:thinking:I got the idea from converse and it turned out good at first but I think I somehow managed to flood a module.

This is really not a good idea to do as it is a side-effect of the metamethod namecall. Roblox may return to fix this and your code will stop working.