#Strictly Typed Minimalistic Timer Module
1 messages Β· Page 2 of 1
π₯
π₯π₯
Timer
Oke
timed signal is a new thing I made it's basically allows you to add timeouts to signals
without promise
it's like promise-light
it has states and :Resolve
and also :Cancel
Like Resume?
have you ever used promise before
it isnt real promise unless you bothered to diet it
lmao
No I thought you mean Resolve and Cancel were methods in the TimedSignal
it's basically that without fancy stuff like :finally and :andThen
yes
they are
what π
ironically the existance of promise is just that 1 xpcall
What about a Started signal
you could gut everything and it still would be a promise
that's a great idea
actually that gives a dumb idea lmao
gut-promise
Im stupid
you don2t need it
you can wrap it inside pcall yourself
although an error state is nice ig
it's super easy to add actually
I just wanna see how bare bones I can make promise be
screw the promise caught a exception, we gonna warn raw error message
Doesn't this Timer module have a memory leak?
π
no?
show me
if it does
PromiseDark
I wonder if heartbeat one was made because I showed DrSinek the ooga booga way
πΏ
yes absolutely
your ooga booga my booga booga
neuron activation
actually the real reason was using coroutines to wait out was really not a great way to handle things
okay biggest challenge of all...
I just came to that conclusion
becsuse promises use link list, but screw that becsuse we can just directly order functions via mixed table
[1..n] are the steps and then ["final"] is the finally
I just don't like the idea of andThen
and :finally
meh
Why does Timer send 0 on the first fire
it just sounds like steps to me tbh
cuz 0 ticks π
firstly do this, then do that, and finally...
yeah but why not just code it
yo sinek could you connect :stop() to .Ended
nah it only fires when the countdown ends
yeh
how
I think that is weird
timer.Ended:Fire()
what should it be
1
You don't start counting at 0 normally?
thanks
1 based indexing overrated π
it actually represents how many ticks were done
And not the current tick
basically the current tick
I mean technically you could just have a long chain coroutine with pcalls if you really despise promises
but I start at 0
lmao
I guess although If Im making a promise replacement
I need to include it probably
:finally is stupid tho
like gang what
is it supposed to run on resolvement?
or maybe the last resolvement Ig
it only makes sense to use these in a loading context when you have a request to some outside stuff
sounds like the last andThen
yeah Idk why it exists
never needed it
istg luau scripters have surpassed actual lua coders
why do we do things much more efficiently with much better looking code π
I used Promise only once. I was like: "What the hell am I using" and deleted it π
I don't like Promise either
like I said it only makes sense to use it when you are making like a catalog avatar creator game
Best use case ever π₯Ή
hmmm maybe renaming :Finally to :Finished, but dunno about that
all I heard is that you wanna use promises only when you're doing like http stuff lmao
correct
if you want to do waiting
and have cancellable stuff
like a round system
use my timed signal π
:explode
I aint masochist
In case of emergency termination
im joking that theres more comments than lines of code
finallyExplode
also awaitStatus is crazy aswell. You either get a request or not bro
you are the one supposed to handle the status
if you need to use awaitStatus your code sucks
that's actually unhinged π₯
What is the reasoning for using an array over a dictionary
sweet performance π
Idk wym
Ironically if they didnt bother making comments so VS people are pleased
it'd magically save like 300 lines
lmao π
what
What does this mean
bigger than entire remote table
Why does array do better than dictionary
it gives you performance when looping over
and keeps memory low
well normally it should
Donβt think it actually helps with memory I feel
You have to keep the array ID though
but arrays can be kept in 1 single contagious memory
yeah but not using it to loop over
this is dod design trust
just be like C
But adding a key to a dictionary to stop you from adding a key to a dictionary doesnβt help π₯
I am not using it inside actual Heartbeat π₯
that's whole point
looping a dict is slow
I know but you said it saves memory
that's a more complicated reason
need to understand how clustering works
plus I doubt it changes much
these are cursed examples
promise needs to be stopped
you can't just wrap task.wait
and call it a utility module
You dont get it, promise people are playing gambit of if some ray of light mutates their bit
They just like Python
from time import sleep π₯
so the status could be "maybe"
local sleep = task.wait π
"maybe not", "probable", "i dont know"
:whenIFeelLikeIt
:iDontFeelLikeIt
You don't understand. You need to think like them to understand them because they were thinking of other way of understanding of task.wait
You don't get it bro
its for those people who get whipped for not scripting fast enough
so they can't bother fixing errors
It's literally just task.wait(). How people can write it slow π
Promise needs you π«΅
I like how we are back to just shit on overcomplicated things which should've not existed in luau
but trust Promisinek will be fire
i use it but i hope they revamp it
Never
which methods do you actively use
if it works they wont touch it
so I can understand the way people use it
lmao
.resolve too
I will also have
- :Cancel
- Error handling
- :Resolve to manually resolve
and also PreResolve
and PostResolve
you're making your own?
damn let me know when it's done
we are at 83 lines rn base is done
We need to introduce the creator of promise and this guy:
https://devforum.roblox.com/t/pauser-a-wait-function-but-better/3942035
A small OOP easy made for convenience use as a wait function Easy to edit and add stuff into it, You stop the wait immedialy example : local p = pauser.new(100) # deploy new wait fuction event:Once(function() p:destroy() # free the wait function end) p:start() # start the wait for 100 seconds print("Wait free !") : Get This Module
wth is this
im dead
I genuinely thought it was timeout
for a sec
and I was like
crazy bait
dang it
"A wait function but better"
bro basically made comments inside the function
with task.wait
--Preparing
task.wait(10)
he used task.wait to kill task.wait
*insert gru
oh hey it looks like something I made via closure lmao
It's literally the wrapper of task.delay and task.wait. How is this better than task.wait? π
how is it still up is a better question to ask
π
I love adding syntax sugar to stuff which dont need it
cuz of all the timer stuff I do
I like how that guy got demolished in comments π€£
i know theres differences between it and the task library but i've never have a need to
what is the most obvious use case in your opinion
between what
And feel bad for him at the same time
timer module?
no coroutines and task lib
oh
task library is a coroutine wrapper with engine scheduler updating all timers
you can make your own task library
suphi made in td video
but you can even go more barebone
damn did bro make everything in the td video
and do it with fully coroutines
yeah π
lmao everyone keeps citing it like a source
it wouldn't be as optimized
that tuto is 7 hours long
pretty sick
best luau tuto Ive ever watched
might have to check it out
okay now the hardest challenge is to predict computers frame time to perfect wait n seconds
lmao
hardware won't allow π
we must get that accurate 0.1
The amount of comments here will soon surpass the Nem's backpack module
main:Lobby(main)
holy shit
I think Im going crazy
not even main.Lobby(main)
Guys Imma make busy waiting with coroutines who support me fr π€
I can't even tell if it was made with AI since AI would make it better imo
can you do that in parallel instead
oh yeah
good idea
excellent
pc crasher 3000
we must use every core because we paid for it
Or just tell: Man, that's the whole ass wrapper for task.delay. Are you okay?
holy
we gonna have 4800 enemies with 240 fps
Bindable event is the biggest bottleneck
I feel like suphi td is more performant on single core
Can roblox introduce a new way to cause segfault?, becsuse I wanna fast deliver parallel values back to main thread
Parallel would benefit if you got 10k or more of RayCasts for example. Or just the enermous amount of math
But I don't remember TD having something like that
SharedTable to make it worse π
Use SharedTable.update() every frame
oh hell nah
Truly the best decision
Trust me bro once you master parallel in roblox
Put the whole TD variables in it and hit update
you can make anything
π₯
so the first thing would be is to port over the thing which rearranges pixels of a image to Obama
YESS PLS
why are we using #1392625916152381580 as chat
lol
don't read the code in the background
music: Vivaldi - Winter (Lud and Schlatts Musical Emporium)
Why not?
ππ₯ππͺπ€π€―ππ₯Ήπ§β₯οΈ
Let's farm some comments
How was your day? @gloomy rapids
yes truly this
Oh
bad π
π
cyall
Cya
Yeah its late
It should be 23:21 for you
maybe wasnt bright idea to stay up, but it was fun so who cares
Agree π―
yo when at promise light
promise light when
I want to make said Pise, but I wonder howd you even gut it lmao
because this technically you passing a traceback and then using xpcall to error handle
these days its only promise heavy
promise without comment is suprisingly low
900 lines spend on comments
still 1.1k is a bit diabolical
so as much comments as the actual code
yes
still 1.1k is huge considering no comments
pure code
although they implement a lot of stuff
and it actually feels like js
which I don't want in roblox
js is already a mess on it's own and roblox doesn't need all that
we have your own systems js dont
so basically this is going to be a new take on promise
pro mise
Romise
truly
just a better coroutine.resumeβ’
@gloomy rapids Im joking that the javascripts promise is better written than roblox promise lmao
What if you port thisπ€
truly just port this and we got promise+\
@gloomy rapids totally a revolutionary way to do error handling
π
Idk
Nothing should be named maybe in codeπ₯
Maybe its the error code
perhaps, might, ImNotSure
But they decided to call it maybeRuntimeError bc it might be runtime error code
Stupid naming tho
possibleRuntimeError
50_50RuntimeError
RuntimeErrorGambit
ngl I think I cracked on how roblox promise is scripted, but I don't feel like recreating it because it already exists
lmao
pov booleans in quantum computers: Yes/True, No/False, uh/maybe
this is dumb, if you can immediately tell what a variables purpose is, it has a good name
I dont agree is is better than maybe
is?
Instead of maybe
isRuntimeError?
no that's worse, it sounds like a boolean
Let me finish
I would name it error_
Its also weird something is a runtime error or nil
I never needed to do this in my code ever
The name of the variable doesnt need to carry the error type
Why is it only runtime error and nil
Error should be unified
if the only reason your variable name isnt overwriting something is because it uses a different casing rule its a bad variable name
Error handling should be unified
Nope
Disagreee
Thats been done so many times
And by very respectable coders
What
pairs has been used many times, and by many respectable coders
your argument is trash
Roblox used to use lua 5.1 directly
"people are on my side" isn't even an argument
This is a preference thing so it is
"people have done this" isn't either
You are missing the point
Read this
its objectively bad
to avoid overwriting api
by using casing rules
You are stupid. Calling naming conventions objectively bad is just stupid
Ofc
that's not what i did
This is a naming convention
If name is api then add _
using naming conventions to avoid overwriting api is objectively bad
no naming convention is objectively bad, thats what youre trying to twist my words to mean
I cant argue with someΔ±ne who calls guidelines or strict rules bad
Sory
Have better things to do rn
is "if this happens just do this" or "never do this" a stricter rule?
i also have a rule yk
its called dont overwrite api
and dont try to lazily hide the fact that youre doing it either
you realize you can't pick the words the language makers pick?
to keep code style consistent across many languages
this is the best way
it's not necessarily "stricter" it's the same level of strictness
this is gpts response
tell me what name you'd pick
error_result is kinda good icl
I would probably use that if I thought for like 3 more seconds
look they check for kind anyways
then why call it runtime error
there are not static error in lua anyways
so you can just call it resulting_error
or error_result
or simply just error_
all work pretty good names
also it's been weeks since this
I don't even remember the context of this code
but yeah this is definitely not a good way to handle errors
a bit unnecessary
v1.15 is here
- Added IsRunning public function
- Switched to zignal
Unexpected timer update
v1.16 is here
- Removed OOP
- Destroyed flag fixed
removed OOP π€
is it now just like a table with Signal and necessary data (ill probably just check it later)
go check it
it's really good
no more metatables
I became anti metatablist
I can just post it here ig lol
dewit
(I wonder why you became anti metatablist, I was there once until I realized its sometimes better to use metatables)
cuz it's clean
bro
code snap doesn't work
for some fucking reason
I find this kinda subjective
depends on what you're doing
Yeah thats the 'meta' trust
I only use this for code that I will never touch
Stuff like utility
I still use OOP
No functionality change
π―
Actually back to some thing
if you dont want OOP, how about... you make it be that you just register under a name
Timer.register(name, config)
Timer.start(name)
Timer.stop(name)
Timer.get(name) <- yields if its not created
a bit cooked icl
especially for a such small object
like a timer
I do that in remote table
every remote table is registered with a name
But yoy knowm...
you save memory by doijg that
very worth
^ I mean what I say is a joke
but there might actually be a use case for it
also if thats what you want to call "Removed OOP"
I mean I just removed metatables
that's it
its pure references now
All roads lead back to OOP
also, thats kinda what __index metamethod does too (refrence coated in sugar)
it's not
unfortunately
__index removes the default trigger for indexing
and runs a different branch of code block
I mean yeah
but if you think about it
it's still just a refrence coated in sugar
Because once you get addicted then it gets hard to stop
it's not tho
π
metatables are not just syntactic sugar
I know
but I still gonna insist that __index in its most simplest form is just sugar
π€
