cmdpwnd, on 09 April 2016 - 09:26 PM, said:
determining which thread a function can run in or which thread is currently running
If a given coroutine - bearing in mind that all CC code is running within a coroutine, even if you perform the TLCO discussed
here, and this isn't true for all other Lua environments - doesn't share the environment of a function it tries to execute, that won't stop the function from executing. For example, the environment tables used by APIs are in no way shared or available to those used by the CraftOS shell script.
You could maybe take a guess as to which coroutine was active using getfenv(), assuming you knew the identities of all the tables and coroutines in play and exactly how they were being put to use. It'd be a somewhat convoluted system and you'd have to be sure everyone who worked within it wanted to play by your rules if you wanted to ensure accuracy.
This is one of those cases where you'd be better off explaining the overall goal you're trying to achieve, rather than asking about the individual steps you've decided to take to reach it. There may be a better way.