Skip to main content

StreamableUtil

This item only works when running on the client. Client

A utility library for the Streamable class.

local StreamableUtil = require(packages.Streamable).StreamableUtil

Functions

Compound

StreamableUtil.Compound(
streamables{Streamable},
handler(
{[childstring]Instance},
troveTrove
) → nil
) → Trove

Creates a compound streamable around all the given streamables. The compound streamable's observer handler will be fired once all the given streamables are in existence, and will be cleaned up when any of the streamables disappear.

local s1 = Streamable.new(workspace, "Part1")
local s2 = Streamable.new(workspace, "Part2")

local compoundTrove = StreamableUtil.Compound({S1 = s1, S2 = s2}, function(streamables, trove)
	local part1 = streamables.S1.Instance
	local part2 = streamables.S2.Instance
	trove:Add(function()
		print("Cleanup")
	end)
end)
Show raw api
{
    "functions": [
        {
            "name": "Compound",
            "desc": "Creates a compound streamable around all the given streamables. The compound\nstreamable's observer handler will be fired once _all_ the given streamables\nare in existence, and will be cleaned up when _any_ of the streamables\ndisappear.\n\n```lua\nlocal s1 = Streamable.new(workspace, \"Part1\")\nlocal s2 = Streamable.new(workspace, \"Part2\")\n\nlocal compoundTrove = StreamableUtil.Compound({S1 = s1, S2 = s2}, function(streamables, trove)\n\tlocal part1 = streamables.S1.Instance\n\tlocal part2 = streamables.S2.Instance\n\ttrove:Add(function()\n\t\tprint(\"Cleanup\")\n\tend)\nend)\n```",
            "params": [
                {
                    "name": "streamables",
                    "desc": "",
                    "lua_type": "{Streamable}"
                },
                {
                    "name": "handler",
                    "desc": "",
                    "lua_type": "({[child: string]: Instance}, trove: Trove) -> nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Trove"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 47,
                "path": "modules/streamable/StreamableUtil.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "StreamableUtil",
    "desc": "A utility library for the Streamable class.\n\n```lua\nlocal StreamableUtil = require(packages.Streamable).StreamableUtil\n```",
    "realm": [
        "Client"
    ],
    "source": {
        "line": 22,
        "path": "modules/streamable/StreamableUtil.lua"
    }
}