Optimizing module functions with the same arguments

I’m creating a module with multiple functions, and I realized that they all have the same first 3 arguments. Is there anyway I can optimize this where the arguments are automatically read? It’s a very small thing that won’t affect the actually affect the functionality of the script, but I’m just looking for ways to improve writing code.

Module:

local hitboxtypes = {}

function hitboxtypes:Attach(player, dmg, hitbox)
	
end

function hitboxtypes:Static(player, dmg, hitbox)
	
end

function hitboxtypes:Size(player, dmg, hitbox)
	
end

return hitboxtypes
1 Like

This may benefit from a more object oriented approach where you create a hitbox class and have these as methods of that class. You may be able to incorporate the other arguments into attributes of each instance that way. That does depend on how you’re planning this to work.

1 Like

This may be a dumb question, but how would I go about creating a hitbox class?

I think this is the most optimized it can be in terms of speed.