From 87d367d68bb2b1e7e88cbbf8ce06cca2317f4c90 Mon Sep 17 00:00:00 2001 From: menarulalam <35981995+menarulalam@users.noreply.github.com> Date: Tue, 14 Nov 2023 15:04:39 -0800 Subject: [PATCH] Enforced relative path formatting --- docs/require-by-string-relative-paths.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/require-by-string-relative-paths.md b/docs/require-by-string-relative-paths.md index 3fb4ef1..75bb286 100644 --- a/docs/require-by-string-relative-paths.md +++ b/docs/require-by-string-relative-paths.md @@ -48,10 +48,6 @@ Modules can be required relative to the requiring file's location in the filesys If we are trying to require a module called `MyModule.luau` in `C:/MyLibrary`: ```lua --- From C:/MyLibrary/SomeModule.luau -local MyModule = require("MyModule") - --- Same as above, identical behavior local MyModule = require("./MyModule") -- From C:/MyLibrary/SubDirectory/SubModule.luau @@ -61,7 +57,7 @@ local MyModule = require("../MyModule") local MyModule = require("../MyLibrary/MyModule") ``` -Relative paths can begin with `./` or `../`, which denote the directory of the requiring file and its parent directory, respectively. When a relative path does begin with one of these prefixes, it will only be resolved relative to the requiring file. If these prefixes are not provided, path resolution will fallback to checking the paths in the `paths` configuration variable, as described later. +Relative paths must begin with `./` or `../`, which denote the directory of the requiring file and its parent directory, respectively. When a relative path does begin with one of these prefixes, it will only be resolved relative to the requiring file. If these prefixes are not provided, path resolution will fallback to checking the paths in the `paths` configuration variable, as described later. When a require statement is executed directly in a REPL input prompt (not in a file), relative paths will be evaluated in relation to the pseudo-file `stdin`, located in the current working directory. If the code being executed is not tied to a file (e.g. using `loadstring`), executing any require statements in this code will result in an error.