Puerts.Lua.Complete
3.0.1
Prefix Reserved
dotnet add package Puerts.Lua.Complete --version 3.0.1
NuGet\Install-Package Puerts.Lua.Complete -Version 3.0.1
<PackageReference Include="Puerts.Lua.Complete" Version="3.0.1" />
<PackageVersion Include="Puerts.Lua.Complete" Version="3.0.1" />
<PackageReference Include="Puerts.Lua.Complete" />
paket add Puerts.Lua.Complete --version 3.0.1
#r "nuget: Puerts.Lua.Complete, 3.0.1"
#:package Puerts.Lua.Complete@3.0.1
#addin nuget:?package=Puerts.Lua.Complete&version=3.0.1
#tool nuget:?package=Puerts.Lua.Complete&version=3.0.1
PuerTS — Lua for .NET
PuerTS is a scripting solution that brings Lua to your .NET applications. Built on Lua 5.4, it provides high-performance script execution with seamless C# interop — using the same unified ScriptEnv API as the JavaScript and Python backends.
Features
- 🚀 High Performance — Powered by Lua 5.4, one of the fastest embeddable scripting languages.
- 🔗 Seamless C# Interop — Call any .NET type directly from Lua, and invoke Lua functions from C#.
- 🌍 Cross-Platform — Supports Windows, macOS, and Linux.
- 🔄 Unified API — Same
ScriptEnvarchitecture as JS and Python backends — easy to switch or mix languages.
Installation
Install via NuGet. The Complete package includes core + native assets for all desktop platforms:
dotnet add package Puerts.Lua.Complete
Or install components separately for finer control:
# Core library (required)
dotnet add package Puerts.Core
# Lua backend
dotnet add package Puerts.Lua
# Native assets per platform (choose what you need)
dotnet add package Puerts.Lua.NativeAssets.Win32
dotnet add package Puerts.Lua.NativeAssets.Linux
dotnet add package Puerts.Lua.NativeAssets.macOS
Supported Platforms
.net8.0+, .netstandard2.1
| Windows (x64) | Linux (x64) | macOS (Universal) | |
|---|---|---|---|
| Lua | ✔️ | ✔️ | ✔️ |
Note: AOT compilation is not currently supported.
Quick Start
using Puerts;
var env = new ScriptEnv(new BackendLua());
// Execute Lua code
env.Eval(@"
local CS = require('csharp')
local Console = CS.System.Console
Console.WriteLine('Hello from Lua!')
");
// Eval with return value (Lua requires explicit 'return')
int result = env.Eval<int>("return 1 + 2");
Console.WriteLine($"Lua result: {result}"); // output: 3
env.Dispose();
Calling C# from Lua
Access .NET types via require('csharp'):
local CS = require('csharp')
local Console = CS.System.Console
local DateTime = CS.System.DateTime
local List = CS.System.Collections.Generic.List(CS.System.String)
-- Create instances and call methods
local now = DateTime.Now
Console.WriteLine('Current time: ' .. now:ToString())
local list = List()
list:Add('hello')
list:Add('world')
Console.WriteLine('Count: ' .. tostring(list.Count))
Note: In Lua, instance methods use the colon syntax
obj:Method(), while static methods use the dot syntaxClass.Method().
Calling Lua from C#
using Puerts;
using System;
var env = new ScriptEnv(new BackendLua());
// Get a Lua function as a C# delegate
var add = env.Eval<Func<int, int, int>>("return function(a, b) return a + b end");
Console.WriteLine(add(10, 20)); // output: 30
// Get a Lua action
var greet = env.Eval<Action<string>>(@"
return function(name)
local CS = require('csharp')
CS.System.Console.WriteLine('Hello, ' .. name .. '!')
end
");
greet("PuerTS");
env.Dispose();
Key Differences from JS
| Feature | JavaScript | Lua |
|---|---|---|
| Environment creation | new ScriptEnv(new BackendV8()) |
new ScriptEnv(new BackendLua()) |
| Console output | console.log(...) |
print(...) |
| Accessing C# types | CS.Namespace.Class |
require('csharp') to get namespace entry |
| Instance method calls | obj.Method() |
obj:Method() (colon syntax) |
| Null representation | null / undefined |
nil |
| Return from Eval | Last expression auto-returned | Explicit return required |
Documentation
For full documentation, tutorials and API reference, visit: https://puerts.github.io/en
License
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Puerts.Core.Complete (>= 3.0.1)
- Puerts.Lua (>= 3.0.1)
- Puerts.Lua.NativeAssets.Linux (>= 3.0.1)
- Puerts.Lua.NativeAssets.macOS (>= 3.0.1)
- Puerts.Lua.NativeAssets.Win32 (>= 3.0.1)
-
net10.0
- Puerts.Core.Complete (>= 3.0.1)
- Puerts.Lua (>= 3.0.1)
- Puerts.Lua.NativeAssets.Linux (>= 3.0.1)
- Puerts.Lua.NativeAssets.macOS (>= 3.0.1)
- Puerts.Lua.NativeAssets.Win32 (>= 3.0.1)
-
net8.0
- Puerts.Core.Complete (>= 3.0.1)
- Puerts.Lua (>= 3.0.1)
- Puerts.Lua.NativeAssets.Linux (>= 3.0.1)
- Puerts.Lua.NativeAssets.macOS (>= 3.0.1)
- Puerts.Lua.NativeAssets.Win32 (>= 3.0.1)
-
net9.0
- Puerts.Core.Complete (>= 3.0.1)
- Puerts.Lua (>= 3.0.1)
- Puerts.Lua.NativeAssets.Linux (>= 3.0.1)
- Puerts.Lua.NativeAssets.macOS (>= 3.0.1)
- Puerts.Lua.NativeAssets.Win32 (>= 3.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.1 | 88 | 3/4/2026 |
| 3.0.0 | 340 | 12/15/2025 |
| 3.0.0-beta1 | 286 | 12/15/2025 |