War3Net.CSharpLua is a C# to Lua compiler built on Microsoft Roslyn, with edits to make it compatible with Warcraft III Lua maps. It is a fork of CSharp.lua and part of the War3Net modding toolset.
- Compile C# source code to Lua, with support for C# 10
- Highly readable code generation via C# AST to Lua AST to Lua code
- Compile from source files, directories, or .csproj projects
- Support for NuGet package and assembly references
- Export metadata, enums, and attributes to Lua
- Inline simple single-line properties
- Support for multi-module compilation
using CSharpLua;
var compiler = new Compiler(
input: "path/to/src",
output: "path/to/output",
lib: "path/to/libs",
meta: "path/to/meta",
csc: null,
isClassic: false,
attributes: null,
enums: null,
isExportEnumAll: false);
compiler.IsExportMetadata = true;
compiler.IsInlineSimpleProperty = true;
compiler.CompileSingleFile("out.lua", "path/to/coresystem");The main types provided by this library are:
CSharpLua.Compiler- Compiles C# source code or projects to LuaCSharpLua.LuaSyntaxGenerator- Generates Lua syntax trees from C# compilation units
- War3Net.CSharpLua.CoreSystem - Lua runtime library required by the compiled output
- War3Net.Build - Generate map scripts and compile Warcraft III maps
War3Net.CSharpLua is part of a fork of CSharp.lua, released as open source under the Apache 2.0 license. General bug reports and contributions should be made to the upstream repository:
For issues specific to the War3Net fork, use the fork repository.
This README was generated with the assistance of AI and may contain inaccuracies. Please verify the information and consult the source code for authoritative details.