#is there a way to check if a block of code is running in a coroutine vs the scripts main thread?
1 messages · Page 1 of 1 (latest)
what on earth are you trying to do that would require this behavior?
i dont think you understand what coroutines are or what threads are, less even how they work in roblox
but to answer your question directly there is no way to tell what kind of thread/run context the code is running in, you have to set it up beforehand so it knows in advance
which kind of eliminates the point of checking
I'm using a system that can watch tasks, and if one runs into an issue, it reports information about itself - now I can write an identifier to just fudge it when the task is initially created but was wondering if it was possible to do it at the time of need, maybe not
why tho
so I can track issues more effectively, one of these tasks for example could be unloading a map or game module whilst the main thing following the user experience doesn't acknowledge it (i.e no "waiting for map" or "waiting for cleanup" etc)
actually
maybe im thinking about this being less complex than it actually is
lmfao
if an unhandled error happens, it's going to break things and throw errors/warnings on its own, wrapping an unhandled error in pcall without handling the error in any meaningful way outside of raising a message is the same as doing nothing at all
in fact may make things harder since it's now being passed through this error handler
i mean what kind of issues are you trying to track exactly
the usage case for that was "are these errors coming from the same run through or different ones" - for example if a map unload after a game was launching 10 errors, or 10 errors were appearing over 10 map unloads etc
its more identification of thread
so write error handling for your map unloader ?
you dont need centralized error handling
it does have error handling, but I use centralised error handling just cause I find it easier
but alright, thank you
if anything i'd suggest you have a notification module that gives messages and you can have a special notification history for admins, for example
** You are now Level 48! **
that's probably much more useful than this thread tracker thing
💤