Skip to content

Releases: lune-org/lune

0.5.6

11 Mar 08:08
72c30d3
Compare
Choose a tag to compare

Added

  • Added support for shebangs at the top of a script, meaning scripts such as this one will now run without throwing a syntax error:

    #!/usr/bin/env lune
    
    print("Hello, world!")

Fixed

  • Fixed fs.writeFile and fs.readFile not working with strings / files that are invalid utf-8

0.5.5

08 Mar 12:59
7cc1aad
Compare
Choose a tag to compare

Added

  • Added support for running scripts by passing absolute file paths in the CLI
    • This does not have the restriction of scripts having to use the .luau or .lua extension, since it is presumed that if you pass an absolute path you know exactly what you are doing

Changed

  • Improved error messages for passing invalid file names / file paths substantially - they now include helpful formatting to make file names distinct from file extensions, and give suggestions on how to solve the problem
  • Improved general formatting of error messages, both in the CLI and for Luau scripts being run

Fixed

  • Fixed the CLI being a bit too picky about file names when trying to run files in lune or .lune directories
  • Fixed documentation misses from large changes made in version 0.5.0

0.5.4

07 Mar 21:22
588ae96
Compare
Choose a tag to compare

Added

  • Added support for reading scripts from stdin by passing "-" as the script name
  • Added support for close codes in the net WebSocket APIs:
    • A close code can be sent by passing it to socket.close
    • A received close code can be checked with the socket.closeCode value, which is populated after a socket has been closed - note that using socket.close will not set the close code value, it is only set when received and is guaranteed to exist after closure

Changed

  • Update to Luau version 0.566

Fixed

  • Fixed scripts having to be valid utf8, they may now use any kind of encoding that base Luau supports
  • The net WebSocket APIs will no longer return nil for partial messages being received in socket.next, and will instead wait for the full message to arrive

0.5.3

26 Feb 20:53
d63ac61
Compare
Choose a tag to compare

Fixed

  • Fixed lune --generate-selene-types generating an invalid Selene definitions file
  • Fixed type definition parsing & generation issues on Windows

0.5.2

26 Feb 16:27
30ab71c
Compare
Choose a tag to compare

Fixed

  • Fixed crash when using stdio.color() or stdio.style() in a CI environment or non-interactive terminal

0.5.1

25 Feb 12:58
2901e85
Compare
Choose a tag to compare

Added

  • Added net.encode and net.decode which are equivalent to net.jsonEncode and net.jsonDecode, but with support for more formats.

    WARNING: Unstable API

    This API is unstable and may change or be removed in the next major version of Lune. The purpose of making a new release with these functions is to gather feedback from the community, and potentially replace the JSON-specific encoding and decoding utilities.

    Example usage:

    local toml = net.decode("toml", [[
    [package]
    name = "my-cool-toml-package"
    version = "0.1.0"
    
    [values]
    epic = true
    ]])
    
    assert(toml.package.name == "my-cool-toml-package")
    assert(toml.package.version == "0.1.0")
    assert(toml.values.epic == true)

Fixed

  • Fixed indentation of closing curly bracket when printing tables

0.5.0

23 Feb 20:29
c2dc8e2
Compare
Choose a tag to compare

Added

  • Added auto-generated API reference pages and documentation using GitHub wiki pages

  • Added support for query in net.request parameters, which enables usage of query parameters in URLs without having to manually URL encode values.

  • Added a new function fs.move to move / rename a file or directory from one path to another.

  • Implemented a new task scheduler which resolves several long-standing issues:

    • Issues with yielding across the C-call/metamethod boundary no longer occur when calling certain async APIs that Lune provides.
    • Ordering of interleaved calls to task.spawn/task.defer is now completely deterministic, deferring is now guaranteed to run last even in these cases.
    • The minimum wait time possible when using task.wait and minimum delay time using task.delay are now much smaller, and only limited by the underlying OS implementation. For most systems this means task.wait and task.delay are now accurate down to about 5 milliseconds or less.

Changed

  • Type definitions are now bundled as part of the Lune executable, meaning they no longer need to be downloaded.
    • lune --generate-selene-types will generate the Selene type definitions file, replacing lune --download-selene-types
    • lune --generate-luau-types will generate the Luau type definitions file, replacing lune --download-luau-types
  • Improved accuracy of Selene type definitions, strongly typed arrays are now used where possible
  • Improved error handling and messages for net.serve
  • Improved error handling and messages for stdio.prompt
  • File path representations on Windows now use legacy paths instead of UNC paths wherever possible, preventing some confusing cases where file paths don't work as expected

Fixed

  • Fixed process.cwd not having the correct ending path separator on Windows
  • Fixed remaining edge cases where the task and coroutine libraries weren't interoperable
  • Fixed task.delay keeping the script running even if it was cancelled using task.cancel
  • Fixed stdio.prompt blocking all other lua threads while prompting for input

0.4.0

11 Feb 22:55
0149093
Compare
Choose a tag to compare

Added

  • Web Sockets

    net now supports web sockets for both clients and servers!

    Note that the web socket object is identical on both client and server, but how you retrieve a web socket object is different.

    Server API

    The server web socket API is an extension of the existing net.serve function.

    This allows for serving both normal HTTP requests and web socket requests on the same port.

    Example usage:

    net.serve(8080, {
        handleRequest = function(request)
            return "Hello, world!"
        end,
        handleWebSocket = function(socket)
            task.delay(10, function()
                socket.send("Timed out!")
                socket.close()
            end)
            -- The message will be nil when the socket has closed
            repeat
                local messageFromClient = socket.next()
                if messageFromClient == "Ping" then
                    socket.send("Pong")
                end
            until messageFromClient == nil
        end,
    })

    Client API

    Example usage:

    local socket = net.socket("ws://localhost:8080")
    
    socket.send("Ping")
    
    task.delay(5, function()
        socket.close()
    end)
    
    -- The message will be nil when the socket has closed
    repeat
        local messageFromServer = socket.next()
        if messageFromServer == "Ping" then
            socket.send("Pong")
        end
    until messageFromServer == nil

Changed

  • net.serve now returns a NetServeHandle which can be used to stop serving requests safely.

    Example usage:

    local handle = net.serve(8080, function()
        return "Hello, world!"
    end)
    
    print("Shutting down after 1 second...")
    task.wait(1)
    handle.stop()
    print("Shut down succesfully")
  • The third and optional argument of process.spawn is now a global type ProcessSpawnOptions.

  • Setting cwd in the options for process.spawn to a path starting with a tilde (~) will now use a path relative to the platform-specific home / user directory.

  • NetRequest query parameters value has been changed to be a table of key-value pairs similar to process.env.
    If any query parameter is specified more than once in the request url, the value chosen will be the last one that was specified.

  • The internal http client for net.request now reuses headers and connections for more efficient requests.

  • Refactored the Lune rust crate to be much more user-friendly and documented all of the public functions.

Fixed

  • Fixed process.spawn blocking all lua threads if the spawned child process yields.

0.3.0

06 Feb 18:25
16d9c94
Compare
Choose a tag to compare

Added

  • Added a new global stdio which replaces console

  • Added stdio.write which writes a string directly to stdout, without any newlines

  • Added stdio.ewrite which writes a string directly to stderr, without any newlines

  • Added stdio.prompt which will prompt the user for different kinds of input

    Example usage:

    local text = stdio.prompt()
    
    local text2 = stdio.prompt("text", "Please write some text")
    
    local didConfirm = stdio.prompt("confirm", "Please confirm this action")
    
    local optionIndex = stdio.prompt("select", "Please select an option", { "one", "two", "three" })
    
    local optionIndices = stdio.prompt(
        "multiselect",
        "Please select one or more options",
        { "one", "two", "three", "four", "five" }
    )

Changed

  • Migrated console.setColor/resetColor and console.setStyle/resetStyle to stdio.color and stdio.style to allow for more flexibility in custom printing using ANSI color codes. Check the documentation for new usage and behavior.
  • Migrated the pretty-printing and formatting behavior of console.log/info/warn/error to the standard Luau printing functions.

Removed

  • Removed printing functions console.log/info/warn/error in favor of regular global functions for printing.

Fixed

  • Fixed scripts hanging indefinitely on error

0.2.2

06 Feb 00:36
bd71075
Compare
Choose a tag to compare

Added

  • Added global types for networking & child process APIs
    • net.request gets NetFetchParams and NetFetchResponse for its argument and return value
    • net.serve gets NetRequest and NetResponse for the handler function argument and return value
    • process.spawn gets ProcessSpawnOptions for its third and optional parameter

Changed

  • Reorganize repository structure to take advantage of cargo workspaces, improves compile times