Skip to main content

SoftRequire

A Util file to help require ModuleScripts and work around cached values.

Functions

Require

SoftRequire:Require(moduleScriptModuleScript) → table

Passed a ModuleScript, will require a Clone() of it. This has the benefit of softRequire(moduleScript) ~= softRequire(moduleScript), whereas require(moduleScript) == require(moduleScript). This gets round the cached value that require() uses.

This is beneficial, as during development you may be constantly updating your Util files. After a macro uses require() on a Util, any further require() calls will use a cached value from the first call. This gets round this issue, and allows us for our macros to always have access to the most up to date version of our Util files.

Show raw api
{
    "functions": [
        {
            "name": "Require",
            "desc": "Passed a ModuleScript, will require a Clone() of it. This has the benefit of `softRequire(moduleScript) ~= softRequire(moduleScript)`, \nwhereas `require(moduleScript) == require(moduleScript)`. This gets round the cached value that require() uses.\n\nThis is beneficial, as during development you may be constantly updating your Util files. After a macro uses `require()` on a Util, any further\n`require()` calls will use a cached value from the first call. This gets round this issue, and allows us for our macros to always have access to\nthe most up to date version of our Util files.",
            "params": [
                {
                    "name": "moduleScript",
                    "desc": "",
                    "lua_type": "ModuleScript"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "table"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 114,
                "path": "docs_api/utils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "SoftRequire",
    "desc": "A Util file to help require ModuleScripts and work around cached values.",
    "source": {
        "line": 100,
        "path": "docs_api/utils.lua"
    }
}