convert_require
Added in 0.10.0
Parameters
Name | Type | Description |
---|---|---|
current |
| The require mode used in the input code |
target |
| The require mode used to generate the new require calls |
This rule is particularly useful if you are writing Lua code that needs to be portable to Roblox, as you can automatically convert requires using file paths (like “./src/mod.lua”) to different path system (like the luau module paths used by Lune) Roblox instances.
Right now, the current and target require modes have certain restrictions:
Mode | path | luau | roblox |
---|---|---|---|
current | ✅ | ✅ | ❌ |
target | ✅ | ✅ | ✅ |
Configuration Overview
Here is an overview of the rule configuration format:
{
rule: "convert_require",
current: {
name: "path",
// optional (defaults to 'init')
module_folder_name: "init",
// optional
sources: {
"@pkg": "./Packages",
},
},
target: {
name: "roblox",
// optional
rojo_sourcemap: "./path-to/sourcemap.json",
// optional (defaults to 'find_first_child')
indexing_style: "find_first_child", // 'wait_for_child' or 'property'
},
}
For more information about how to configure each of require mode, visit: