Forest β€” Simplify Work With Modules

I developed Forest to simplify work with Roblox modules because having a bunch of useless stuff in your ReplicatedStorage is an eyesore. Using Forest, you can create namespaces with content such as functions and variables and use it in your scripts later:

-- ServerScriptService/Script1
local f = require(12114626976) -- Require Forest

f.namespace "my.funcs" { -- Defining namespace
    sayHello = function(name) -- Function my.funcs.sayHello
        print(string.format("Hello, %s!", name))
    end
}
-- ServerScriptService/Script2
local f = require(12114626976) -- Require Forest

local funcs = f.using "my.funcs" -- It will wait for namespace to be defined
funcs.sayHello("Bob") -- Hello, Bob!

Forest also contains bult-in namespaces (intermediate namespaces are in italics, it makes no sense to use them because they doesn’t contain any functions):

  • forest
    • collections - contains functions to work with Lua (table) & Forest (arrays, dicts, etc.) collections
      • array
      • dictionary
        • entry
      • set
      • tuple
      • iterator
    • enum
    • functions

Forest indexes starts from 0 so you can convert from Lua index to Forest index (and back) using forest.collections.luaToForestIndex (forest.collections.forestToLuaIndex).

4 Likes