[READ-ONLY] Mirror of https://github.com/thoda-dev/du-nested-coroutines. A small script for DU to avoid any CPU load error
0

Configure Feed

Select the types of activity you want to include in your feed.

6 1 5

Clone this repository

https://tangled.org/thoda.dev/du-nested-coroutines https://tangled.org/did:plc:xw266lwomcdrkdkfe5tr735m
git@tangled.org:thoda.dev/du-nested-coroutines git@tangled.org:did:plc:xw266lwomcdrkdkfe5tr735m

For self-hosted knots, clone URLs may differ based on your setup.



README.md

du-nested-coroutines#

A small script for DU to avoid any CPU load error

How to Install#

Copy the content of the file config.json In the game, right click on the programming board, and select "Advanced" and "Paste Lua configuration from clipboard".

How to use#

Write your functions in the unit > start event, in the table MyCoroutines.

You can use the stardard coroutine.yield method in your function by always placing as parameter the table coroutinesTable[index] replacing index with the index of your function (1 for the 1st function, 2 for the second and so on)

example#

MyCoroutines = {
    function()
        for i=0, 10 do
            system.print("function 1 --- "..i)
            coroutine.yield(coroutinesTable[1])--start with index 1 and so on
        end
    end,
    function()
        for i=0, 10 do
            system.print("function 2 --- "..i)
            coroutine.yield(coroutinesTable[2])--the second fonction yiel is with index 2
        end
    end
}

Support or donation#

if you like it,