ok so ik how to make methods for stuff like keywords or how can i say, "default" classes idk(for example ik how to make methods for Instance or game:GetService("Players") or even for a specific part in the workspace):
--module script
local custom_instance_constructor = {}
function custom_instance_constructor.poop(obj)
obj.Name = "poop"
end
return setmetatable(custom_instance_constructor, {__index = Instance})
--server script
local Instance = require(module)
Instance.poop(workspace.Part) --works fine
, but how would i make methods or properties for classes made from the Instance constructor?
i tried doing this:
local custom_part = {}
function custom_part:poop()
self.Name = "poop"
end
return setmetatable(custom_part, {__index = Instance.new("Part")})
but then i just cant do this:
local Instance.new("Part") = require(module) --errors
or
local Part = Instance.new("Part") --just makes a part
or
local Part = require(module)