Garry's Mod

Garry's Mod

Not enough ratings
[E2] CoroutineCore
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Build, Fun
File Size
Posted
Updated
14.027 KB
19 Sep, 2020 @ 10:09pm
15 Feb, 2021 @ 1:40am
3 Change Notes ( view )

Subscribe to download
[E2] CoroutineCore

In 1 collection by Vurv
Expressive Alpha Testing
23 items
Description
Anyone seeing this from now on, This addon will not be updated actively and is superceded by VExtensions. Download it here: https://github.com/Vurv78/VExtensions. (It will be on the workshop as well soon)

## Main Info
This is a sub-addon in VExtensions that adds coroutines to expression2. These work by turning user-defined functions into their own coroutine objects that you can interact with in E2.

In a simple way to explain it, you can take a single function and allow yourself to make that function sleep inside of it and unpause it later. Like sleep() functions in any programming language. For a slightly more advanced explanation: https://wiki.facepunch.com/gmod/coroutine

This allows you to do stuff like huge nested for loops, as long as you properly sleep / wait, you will never have any quota issues. Also helps for avoiding quotas like prop spawn quota. See the example(s) below.

If you find any bugs, please report them to the Issues[github.com] page.

# Documentation Here!
https://github.com/Vurv78/VExtensions/wiki/CoroutineCore

# Example
@name CoroutineCore Example @persist Co:coroutine if(first()){ function thread(){ while(1){ coroutineWait(5) print("5 seconds have passed") } } Co = coroutine("thread") runOnTick(1) }elseif(tickClk()){ if(Co:status()!="dead"){ Co:resume() } }
See more in-depth examples at our Discussions[github.com]
Popular Discussions View All (1)
0
18 Feb, 2021 @ 2:35pm
Information
Vurv
11 Comments
[DSTM] Naki 4 Jun, 2023 @ 4:25am 
i never thought i would ask this from you but uh, knowing your coding skills, could you try to make a core for post processing effects, so i don't have to spam concmd to switch between things
[MGE] SlavaND 22 Nov, 2022 @ 8:54am 
ГОВНО
gorlix 3 Mar, 2022 @ 2:59am 
osu!
Vurv  [author] 14 Feb, 2021 @ 5:32pm 
Also, check out the documentation on the VExtensions wiki here, to prepare for the changes https://github.com/Vurv78/VExtensions/wiki/CoroutineCore

Coroutines have changed considerably because they didn't work for months,
* They now share memory with the main thread
* Only *local* defined variables persist, if you declare a variable inside the coroutine it will be deleted just as regular variables in E2 do every tick.
and there's a lot of new functions, such as coroutineYield(), coroutineYield(tbl) ...
Vurv  [author] 14 Feb, 2021 @ 5:28pm 
Just don't want to leave it in this state, because of an obvious infinite-loop crash. :v
Vurv  [author] 14 Feb, 2021 @ 5:28pm 
VExtensions will go on the workshop as soon as I test it out for 0.3.2, yeah, I was thinking of updating CoroutineCore for the last time as well, but I need to replace one dependency. Give me a day and I'll get it done :steamthumbsup:
Mercury, 80Hg 14 Feb, 2021 @ 4:49pm 
Or at least upload vextensions to the workshop.
Mercury, 80Hg 14 Feb, 2021 @ 4:48pm 
So why not just update it with the latest version from Git? I'd much rather have the convenience and easy access of a workshop addon tbh.
Vurv  [author] 14 Feb, 2021 @ 4:38pm 
Anyone seeing this from now on, This addon is now deprecated and is superceded by VExtensions. Download it here: https://github.com/Vurv78/VExtensions
Mercury, 80Hg 21 Oct, 2020 @ 8:35am 
Is it possible to repeat a part of a coroutine while for example A is < 1 and continue only if it's above or equal 1? If so, how would I go about doing that?