So is there a way to change a type of value in a table? I’m asking because with this signal module I’m using, you can call :Connect which accepts a function like so:
So to access this type, I exported it like so:
Then in a separate script, if I want to change type signal to be a function that takes a function that accepts certain parameters, how would I do that?
For example, let’s say I’m creating a signal that needs to take a function with the parameter “number”, how do I do this?
However when indexing the table.Idled, it doesn’t replace the function with the typechecker, it instead gives me the option between (any) → (any) and (number) → (any) as if there were multiple options. Any ideas?
However I was wondering if there was a way to do this without literally assigning self.Idled.Connect to be self.Idled.Connect
Also note self.Idled is a non-native signal object but works identically to RBXScriptSignal.
Okay, so I’m making an extension of the humanoid which offers a way to tell if the humanoid idled, which is the humanoid.Idled event here:
function module.new(humanoid: Humanoid)
local self = {}
self._extends = humanoid
self.Idled = signal.new() -- returns a generic signal object but doesn't have anything special about it
self.Idled.Connect = self.Idled.Connect :: (self: typeof(self.Idled), () -> ()) -> (signal.Connection)
So, in Luau, when you go to pass a function to signal:Connect, it tells you the parameters to put into that function:
The problem is that I’m assigning a new value to self.Idled.Connect when I do this, even though the new value is the same as the old value, particularly this line:
self.Idled.Connect = self.Idled.Connect
So I’m wondering if there’s any way to modify the type without assigning a new value to self.Idled.Connect