How do I get the task library with Luau console?

So I recently learned about the Luau console, and how you can download it and run Luau code on your computer, so I set up a VSCode build task for it with some other stuff, then I noticed that the task library wasn’t included in the console, so I wanted to know, where is it, and how do I get it?

image

I just realized that the task library might be impossible to add to the Luau console:

Since the Luau console is not connected to the engine, it might be impossible.

I’d have to investigate this for myself, but I’m pretty sure the task library is exclusive to Studio, like it’s a part of Roblox APIs.

Correct me if I’m wrong though.

1 Like

It probably is, I stated this in my edit of the original topic. If it that is the case, then I’m not sure how to add delays to my code without loops.

Also I hate doing this:

function sleep(time: number)
    local s = os.clock()
    repeat until os.clock > s + time
    return true
end

It’s just slow and wasteful, when using NLua with C#, I like to include a sleep function myself with a custom library I made.

our engine’s task scheduler

It doesn’t exist because Luau doesn’t have a task scheduler. You’ll have to write your own. Have fun I guess.

You might be interested in libuv, but I don’t know much about it.

2 Likes

Doesn’t have it. You’re better off using LuaJIT instead anyway as desktop Luau is practically worthless as it can’t do anything file, io, or anything relevant to desktop use.

1 Like

Luau can reference files, or at least require module files, here is an example:

local Test = require("(REDACTED)\\Luau\\Files\\Test")

Test.a()

Test.luau:

local test = {  }


function test.a()
    print("aaa")
end

return test

Output:

aaa

I just downloaded LuaJIT, and it’s pretty nice.

That’s because Luau is designed for embedded usage – that’s why it’s literally called an “embeddable scripting language” on their website.

You are expected to provide facilities like file access and threading yourself.

If you want a general purpose language, try Python or the millions of other programming languages out there.

1 Like