Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
292 changes: 292 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ petgraph = "0.8.3"
regex = "1.12.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.149"
serde_with = "3.18.0"
serde_yaml = "0.9.33"
toml = "1.1.2"
tracing = { version = "0.1", optional = true }
Expand Down
1 change: 0 additions & 1 deletion site/content/docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ Any missing field will be replaced with its default value.

// Configure how requires are interpreted
require_mode: {
// Currently, the only supported require mode is `path`
name: "path",

// When requiring folders, require the file named like this value inside of it
Expand Down
38 changes: 38 additions & 0 deletions site/content/docs/lua-require-mode/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: Lua Require Mode
description: How lua (and darklua) understands require calls
group: Configuration
order: 6
---

This require mode is used for lua programs outside of the Luau ecosystem, including PUC lua, luajit, and most other plain lua
implementations that include a require function.
For more information, please refer to the documentation for [package.searchpath at lua.org](https://lua.org/manual/5.5/manual.html#pdf-package.searchpath).

## Bundling Support

It can be configured in the **bundle** part of the configuration file. For a quick overview of the bundling configuration, see [the documentation page](../bundle/).

## Configuration

The lua require mode uses the environment variable `LUA_PATH` by default as the search path,
but it can be configured to either use a different environment variable, just use the default search path, or
to use a string from the configuration file.
Lua's require does not support aliases or hierarchy beyond the filesystem, so there is no configuration for them.
Note that despite lua's require not supporting embedding text, JSON, TOML, and YAML files, you may do so with darklua,
as long as it is present in the search string.

### Example
```json5
{
bundle: {
require_mode: {
name: "lua",
env: "DARKLUA_PATH",
// Path takes priority over env when provided. In the search string,
// order is important.
path: "./?.luau;./?/init.luau;./res/?.json;./res/?.toml"
}
}
}
```
Loading