Start working on getting require semantics up to date

This commit is contained in:
Filip Tibell 2025-04-24 20:38:10 +02:00
parent acd0f126e5
commit a673f80c95
No known key found for this signature in database

View file

@ -85,7 +85,11 @@ async fn require(lua: Lua, (source, path): (LuaString, LuaString)) -> LuaResult<
"Require with custom alias must contain '/' delimiter",
))?;
alias::require(lua, &context, &source, alias, path).await
} else {
} else if path.starts_with("./") || path.starts_with("../") {
path::require(lua, &context, &source, &path).await
} else {
Err(LuaError::runtime(
"Require path must start with \"./\", \"../\" or \"@\"",
))
}
}