1use lux_lib::{config::Config, lua_installation::LuaInstallation, lua_version::LuaVersion};
2
3use miette::{miette, Result};
4
5pub async fn install_lua(config: Config) -> Result<()> {
6 let version_stringified = &LuaVersion::from(&config)?;
7
8 let lua = LuaInstallation::install(version_stringified, &config).await?;
11 let lua_root =
12 lua.includes()
13 .first()
14 .and_then(|dir| dir.parent())
15 .ok_or_else(|| {
16 miette!(
17 help = "ensure that pkg-config is installed and configured, and that you have Lua installed",
18 "error getting lua include parent directory"
19 )
20 })?;
21
22 tracing::info!(
23 "Installed Lua ({}) to {}",
24 version_stringified,
25 lua_root.display(),
26 );
27
28 Ok(())
29}