Skip to content

scoped -> Scope<T>

function Fusion.scoped<Methods...>(
    ...: (Methods & {})...
): Scope<merge(Methods)>

Returns a blank scope. Any method tables passed in as arguments are merged together, and used as the __index of the new scope, such that they can be called with method notation on the created scope.

Pseudo type

Luau doesn't have adequate syntax to represent this function.

Scopes are not unique

Fusion can recycle old unused scopes. This helps make scopes more lightweight, but it also means they don't uniquely belong to any part of your program.

As a result, you shouldn't hold on to scopes after they've been cleaned up, and you shouldn't use them as unique identifiers anywhere.


Parameters

... : Methods & {}

A series of tables, ideally including functions which take a scope as their first parameter. Those functions will turn into methods on the scope.


Returns -> Scope<T>

A blank scope with the specified methods.


Learn More

Back to top