⚙️Threading

Register

MTools.Threading.Register(callback, critical, other);

NameTypeDescription

callback

function

A function called in another thread.

critical

table

Optional. Releases ownership of the specified critical section object.

other

all

It is better to use 1. Other arguments.

Allows functions to be called in separate threads. Example usage:

MTools.FileSystem.CreateDir("nl\\Test");

function MonyTools()
    MTools.Network.Download("https://www.meme-arsenal.com/memes/96941a83a50bc9cbb0a4fefc5a581eac.jpg", "nl\\Test\\Meme.png");
end

local Test = MTools.Threading:Register(MonyTools, nil, 1);
-- Allows you to download any files without freezing the game.

Destroy

Thread:Destroy();

NameTypeDescription

-

-

-

Allows you to kill the flow. Example usage:

-- You can use the example from Register.
Test:Destroy();
-- In this case "Test" is the name of the variable to which the thread from the example above is assigned.

Last updated