Skip to main content

About Permafrost

Permafrost is a Luau library for working with immutable data structures, including many built-in data manipulation functions.

Immutable data structures provide a variety of benefits as a result of not being able to be modified after creation, including being:

  • easier to reason about, and test,
  • easier to use in concurrent environments.

You don't have to worry about whether or not you've cloned a table before editing its contents - with immutability you can never accidentally edit the original.

Check out the API for the available classes and methods.

Accessing the data methods

There are a variety of ways to access and use the data manipulation methods for List and Dictionary instances.

  1. The recommended approach is to access the List or Dictionary classes, both of which are accessible from the top-level module:

    Permafrost.List.Method(listInstance, ...)
    Permafrost.Dictionary.Method(dictionaryInstance, ...)
  2. You can also access the classes via the Immutable class:

    Permafrost.Immutable.List.Method(listInstance, ...)
    Permafrost.Immutable.Dictionary.Method(dictionaryInstance, ...)
  3. If you'd rather deal only with the Immutable class, all methods are available directly on Immutable:

    Permafrost.Immutable.Method(listInstance, ...)
    Permafrost.Immutable.Method(dictionaryInstance, ...)
  4. The methods can also be called directly on the Immutable instance using colon syntax and adding an underscore to the method name:

    listInstance:_Method(...)
    dictionaryInstance:_Method(...)
    -- Note the underscore at start of method name

    ⚠️ The main downside to this option is that it is not as clearly functional programming, and therefore a future reader may misinterpret the methods as mutative.