discord_luau/stream

Discord-Luau Stream - stream implementation used to navigate through strings.

discord-luau

Stream implementation used to navigate through strings safely.

Source: packages/stream

Installation

pesde add discord_luau/stream

Example

local Stream = require("./luau_packages/stream")

local stream = Stream.new("Content-Type: text/plain\r\n")

local key = stream:advanceUntil(function(character)
    return character == ":"
end)

stream:advance(2)
stream:trim()

local value = stream:readUntilEnd()

print(key) -- "Content-Type"
print(value) -- "text/plain"

Full documentation at discordluau-docs.devcomp.workers.dev.

Contributing

Contributions are welcome via the repository at github.com/DiscordLuau/discord-luau.

License

This package is licensed under the MIT License.