Note
The LuaInstaller project does not support cross-compilation. This means that you must build for the architecture of the underlying operating system (x64 for a 64-Bit Windows, x86 for a 32-bit Windows, and ARM64 for Windows on ARM).
Includes the main functionality to install Lua completely on your computer. The other projects are built around this core project as an interface to the end-user. You can even embed it on your own .NET projects to have a Lua installer feature available.
LuaVersion[] versions = LuaWebsite.QueryVersions();
foreach (LuaVersion v in versions)
{
Console.WriteLine(" -> Lua " + v.Version);
}LuaVersion latest;
if (LuaWebsite.TryGetLatestVersion(out latest))
{
Console.WriteLine("Latest Lua version is: " + latest.Version);
}
else
{
Console.WriteLine("Unable to get the latest version. Please, check your internet connection and try again.");
}IInstalledComponents components = new InstalledComponents();
foreach (VisualStudio vs in components.AllVisualStudioX64())
{
Console.WriteLine("Installation directory: " + vs.VsDir);
Console.WriteLine("MSVC directory: " + vs.VcDir);
Console.WriteLine(vs.Version.ToString());
}IInstalledComponents components = new InstalledComponents();
foreach (WindowsSdk sdk in components.AllWindowsSdkX64())
{
Console.WriteLine(sdk.Version.ToString());
}LuaVersion luaVersion = ...; /* query as above */
VisualStudio vs = ...; /* query some x64 Visual Studio as above */
WindowsSdk sdk = ...; /* query some x64 Windows SDK as above */
/*
EnvironmentVariableTarget.User or EnvironmentVariableTarget.Machine
requires Admin privileges
*/
EnvironmentVariableTarget? env = null;
VisualStudioToolset toolset = vs.Toolset;
ICompiler compiler = new VisualStudioCompiler(toolset.Cl);
ILinker linker = new VisualStudioLinker(toolset.Link);
InstallationManager manager = new InstallationManager(compiler, linker);
manager.InstallationProgressChanged += (sender, e) =>
{
if (e.Progress == Finished)
{
Console.WriteLine("Lua was installed!");
}
};
// The next line will block the current thread.
// It is a good idea to run this operation
// on a background worker thread
// (System.ComponentModel.BackgroundWorker),
// and listen to progress changes.
manager.ExecuteInstall(luaVersion, "C:\\Lua", vs, sdk, env);