Immutable and persistent data structures for Lua
immut.lua is a single-file pure Lua library and does not require any external dependencies. It is designed to work with Lua 5.1 and later, LuaJIT, and Luau (Roblox).
All you need to start using the library is the immut.lua source file. You can download it from the releases page or clone the repository and copy the file to your project.
If you are using LuaRocks, you can install the library using the following command:
luarocks install immut.luaComing soon...
list_mode :: 'copy' | 'isll'
AVAILABLE_LIST_MODES :: list_mode[]
dict_mode :: 'copy' | 'hamt' | 'tree'
AVAILABLE_DICT_MODES :: dict_mode[]
list :: list_mode -> list_mt
list_mt:size -> integer
list_mt:empty -> boolean
list_mt:head -> any
list_mt:last -> any
list_mt:tail -> list_mt
list_mt:init -> list_mt
list_mt:cons :: any -> list_mt
list_mt:snoc :: any -> list_mt
dict :: dict_mode -> dict_mt
dict_mt:size -> integer
dict_mt:empty -> boolean
dict_mt:assoc :: any, any -> dict_mt
dict_mt:dissoc :: any -> dict_mt
dict_mt:lookup :: any -> any
dict_mt:contains :: any -> boolean
Coming soon...
immut.lua is licensed under the MIT License. For more details, see the LICENSE.md file in the repository.