SquidStd.Scripting.Lua
0.4.0
See the version list below for details.
dotnet add package SquidStd.Scripting.Lua --version 0.4.0
NuGet\Install-Package SquidStd.Scripting.Lua -Version 0.4.0
<PackageReference Include="SquidStd.Scripting.Lua" Version="0.4.0" />
<PackageVersion Include="SquidStd.Scripting.Lua" Version="0.4.0" />
<PackageReference Include="SquidStd.Scripting.Lua" />
paket add SquidStd.Scripting.Lua --version 0.4.0
#r "nuget: SquidStd.Scripting.Lua, 0.4.0"
#:package SquidStd.Scripting.Lua@0.4.0
#addin nuget:?package=SquidStd.Scripting.Lua&version=0.4.0
#tool nuget:?package=SquidStd.Scripting.Lua&version=0.4.0
<p align="center"> <img src="https://raw.githubusercontent.com/tgiachi/squid-std/main/assets/icon.png" alt="SquidStd" width="120" height="120" /> </p>
<h1 align="center">SquidStd.Scripting.Lua</h1>
<p align="center"> <a href="https://www.nuget.org/packages/SquidStd.Scripting.Lua/"><img src="https://img.shields.io/nuget/v/SquidStd.Scripting.Lua.svg" alt="NuGet" /></a> <img src="https://img.shields.io/nuget/dt/SquidStd.Scripting.Lua.svg" alt="Downloads" /> <a href="https://tgiachi.github.io/squid-std/articles/scripting-lua.html"><img src="https://img.shields.io/badge/docs-DocFX-1390A3.svg" alt="docs" /></a> <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license" /> </p>
Lua scripting for SquidStd. Hosts a Lua engine (IScriptEngineService) that exposes .NET methods to
scripts through attribute-decorated modules, bridges events, generates .luarc typings/docs, and
supports init scripts, constants, and callbacks.
Install
dotnet add package SquidStd.Scripting.Lua
Features
IScriptEngineService— load and run Lua scripts; register modules, constants, callbacks, init scripts.- Attribute-based modules: mark a class
[ScriptModule]and methods[ScriptFunction]to expose them. container.RegisterScriptModule<TModule>()/RegisterLuaUserData<T>()registration extensions.- Event bridging to the SquidStd event bus (
ILuaEventBridge). - Built-in modules (logging, events, random) and
.luarcdocumentation generation.
Usage
using DryIoc;
using SquidStd.Scripting.Lua.Attributes.Scripts;
using SquidStd.Scripting.Lua.Extensions.Scripts;
[ScriptModule("math2")]
public sealed class MathModule
{
[ScriptFunction("add")]
public int Add(int a, int b) => a + b;
}
var container = new Container();
container.RegisterScriptModule<MathModule>();
// Resolve IScriptEngineService to load and execute scripts that call math2.add(1, 2).
Key types
| Type | Purpose |
|---|---|
IScriptEngineService |
Lua engine: load/run scripts, register modules/constants/callbacks. |
ILuaEventBridge |
Bridges Lua scripts to the event bus. |
ScriptModuleAttribute / ScriptFunctionAttribute |
Expose .NET classes/methods to Lua. |
AddScriptModuleExtension |
RegisterScriptModule<T>() / RegisterLuaUserData<T>(). |
License
MIT — part of SquidStd.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- DryIoc.dll (>= 5.4.3)
- MoonSharp (>= 2.0.0)
- SquidStd.Abstractions (>= 0.4.0)
- SquidStd.Core (>= 0.4.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.