was wondering if void
is a valid typechecker because I’m using in scenarios where a function doesn’t really return anything, like damaging.
It also returns error-type?
How would I fix this though?
I get a strict warning from putting the function returning never
how would I get rid of it?
how about nil instead of never?
Gives off same warning too.
can i see how you typecheck your function?
function CleanupDeadMess(state:boolean?):never?
Character.Health.Enabled = state -- is player actually dead? regardless.
if state then
Humanoid.WalkSpeed += 12
print("player DID not die while downed")
else
print("player did die while downed")
end
script.Value.Value = false
script.Downed.Value = false
end
You can try something like this?:
local function voidReturnType(): ()
end
void
itself doesn’t exist as a type
That fixes it, but why ()
isn’t that meant for functions?
I’m not sure why the double parenthesis are something that’s usable, but it essentially functions as a pseudo-void type.
It’s different from the function type though:
pseudo-void: ()
function-type: (...any) -> any
try removing the ?
after never
Regardless, seems like putting any type besides ()
makes the engine expect the function to return at least something.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.