Kayoh's Interval

Information

Kayoh’s Interval creates continuous loops based on an inputted interval time with accurate type-checking and easy destruction capabilities.

API

Interval(number, (number, ...any) -> (), ...: any?): () -> ()
Creates an interval, returns a destructor function.

Disclaimer

Don’t change any code from the module itself, as it’s a Roblox Package and will automatically get an update if I implement a change.

Link

1 Like

Isnt this just the same as a while true do loop w a task.wait at the end?

2 Likes
local function Loop<Arguments...>(Duration: number, Function: (Arguments...) -> (), ...: Arguments...)
	while true do
		Function(...)
		task.wait(Duration)
	end
end

local function Interval<Arguments...>(Duration: number, Function: (Arguments...) -> (), ...: Arguments...): thread
	return task.delay(Duration, Loop, Duration, Function, ...)
end
2 Likes

No, it uses the task library in its entirety without any kind of while loop.

I don’t get why you posted that, especially when it’s not even the same code as the interval package.

A single thread running a while-loop is much more performant than spawning a new thread every interval.

I was showing that this resource is trivial and can be replicated better in 10 lines.

2 Likes

There wasn’t a real need for that, regardless of if it can be replicated or not, it’s still a resource regardless.

Not trying to be rude or anything but I don’t think this is worth publishing in this category as stated below;

As stated above, this “resource” basically just consists of a while loop. A semi-experienced developer can replicate the functionality of this in less than 10 minutes of time.

2 Likes

We commonly know that the rule is never actually followed. On top of that, I made this module just for a “cleaner” option to this “while true” loop that peeps keep talking about, get off my back.

Y’all taking this like its really deep, if you don’t like the resource or its not usefull for you, move on. :joy:

2 Likes

That’s what I’m thinking, I just released this because I wanted to release it, there’s been no need to say “this resource isn’t needed”.

they b too busy n insecure acting like their stuff is better :joy: the module isnt even that bad too