#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)

viscid summit
#

or is it just more effective to ignore entirely and just create a new coroutine either way

fiery blaze
#

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

viscid summit
#

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

fiery blaze
#

why tho

viscid summit
#

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

fiery blaze
#

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

viscid summit
#

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

fiery blaze
#

so write error handling for your map unloader ?

#

you dont need centralized error handling

viscid summit
#

it does have error handling, but I use centralised error handling just cause I find it easier

#

but alright, thank you

fiery blaze
#

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

zinc belfryBOT
#

studio** You are now Level 48! **studio

fiery blaze
#

that's probably much more useful than this thread tracker thing

fair nexus
#

💤

viscid summit
#

by centralised error handling, I mean that things like the map loader does have its own error handler, but the centralised one just mentions that there was an error, doesn't do anything with it that gives notifications or lists for debugging

#

yeah