Giter Club home page Giter Club logo

Comments (6)

vegorov-rbx avatar vegorov-rbx commented on July 4, 2024 3

While we might add more os library methods/IO/dynamic modules in the future specifically for luau build as an executable, right now we don't have this on our roadmap.

Like it was mentioned, users building Luau from source can add any methods they need to the global environment.

You can also look at this project that already extends default Luau environment with IO features and other things: https://github.com/lune-org/lune (note, this is not a project managed/supported by the Luau org)

from luau.

cloewen8 avatar cloewen8 commented on July 4, 2024 1

Same problem here, different use case. I'm looking into using Luau in a music player addon. I want to allow users to quickly automate tasks without needing to write a custom C++ addon.

Writing files (and requiring native modules) are common tasks. I can write my own functions for this, but it would be nice to have a starting point. Even if Lua's existing libraries where simply modernized enough for Luau to function.

from luau.

UtoECat avatar UtoECat commented on July 4, 2024

All I/O support has been removed to provide sandboxing capabilities.

There are certain problems with the fact that several unsafe luau scripts will consume input from different threads at the same time, for example, or if the native application that embeds luau needs that input.

Additionally, both io.read() and io.write() can cause the thread to block until the operation completes or new data is received, which is not always acceptable.

If your task really requires terminal I/O and you understand all the implications, you can wrap the C getchar()/putchar() functions quite easily and add the wrapped functions to a global table. It won't take more than 10-20 lines of C/C++ code.

from luau.

creepersaur avatar creepersaur commented on July 4, 2024

All I/O support has been removed to provide sandboxing capabilities.

There are certain problems with the fact that several unsafe luau scripts will consume input from different threads at the same time, for example, or if the native application that embeds luau needs that input.

Additionally, both io.read() and io.write() can cause the thread to block until the operation completes or new data is received, which is not always acceptable.

If your task really requires terminal I/O and you understand all the implications, you can wrap the C getchar()/putchar() functions quite easily and add the wrapped functions to a global table. It won't take more than 10-20 lines of C/C++ code.

I was hoping it would be easier to take input, as I would assume most people who use Roblox or luau haven't done much C/C++ or know how to wrap lua with it (this includes me.) And it would make sense pausing a thread until I/O actions are completed.

Could you provide a resource for me to look through with regards to this though?

from luau.

UtoECat avatar UtoECat commented on July 4, 2024

as I would assume most people who use Roblox or luau haven't done much C/C++ or know how to wrap lua with it (this includes me.)
Could you provide a resource for me to look through with regards to this though?

Wait, are you using the luau CLI utility?

I think it would make a little more sense to have these functions included with the CLI... But at the same time, this can lead to some confusion, because the embedded luau does not have such functions.

Anyway, back to your situation. If you find it difficult to work with C/C++ code and the LUA C API, I would suggest using regular lua or luajit.
The lack of IO functions is not as critical as the lack of ability to dynamically load native code (compiled C/C++/any language) libraries to expand the capabilities of your scripts... And Luau does not support dynamic loading of theese libraries.

from luau.

creepersaur avatar creepersaur commented on July 4, 2024

Wait, are you using the luau CLI utility?
I'm using the luau.exe file from the luau-lang.org website. I'm finding it really hard (and annoying) to build luajit. As they say "only source code" is available and you have to build the luajit.exe yourself.

And embedded luau doesn't need IO support, which I agree, but it generally is rather useful. Python is multipurpose and has IO, I wished it was faster though.

Is there a public luajit.exe file? I'm getting errors trying to build from source and it would be way simpler using an exe.

from luau.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.