SquidStd.Scripting.Lua
0.34.0
See the version list below for details.
dotnet add package SquidStd.Scripting.Lua --version 0.34.0
NuGet\Install-Package SquidStd.Scripting.Lua -Version 0.34.0
<PackageReference Include="SquidStd.Scripting.Lua" Version="0.34.0" />
<PackageVersion Include="SquidStd.Scripting.Lua" Version="0.34.0" />
<PackageReference Include="SquidStd.Scripting.Lua" />
paket add SquidStd.Scripting.Lua --version 0.34.0
#r "nuget: SquidStd.Scripting.Lua, 0.34.0"
#:package SquidStd.Scripting.Lua@0.34.0
#addin nuget:?package=SquidStd.Scripting.Lua&version=0.34.0
#tool nuget:?package=SquidStd.Scripting.Lua&version=0.34.0
<h1 align="center">SquidStd.Scripting.Lua</h1>
Lua scripting for SquidStd. Hosts a Lua engine (IScriptEngineService) that exposes .NET methods to
scripts through attribute-decorated modules, bridges events to the SquidStd event bus, ships built-in
modules (logging, events, random), generates .luarc typings/docs, and supports init scripts, constants,
and callbacks.
Install
dotnet add package SquidStd.Scripting.Lua
Usage
using DryIoc;
using SquidStd.Generators.Scripting.Lua;
using SquidStd.Scripting.Lua.Attributes;
using SquidStd.Scripting.Lua.Attributes.Scripts;
using SquidStd.Scripting.Lua.Extensions.Scripts;
[RegisterScriptModule]
[ScriptModule("math2")]
public sealed class MathModule
{
[ScriptFunction("add")]
public int Add(int a, int b) => a + b;
}
var container = new Container();
container.RegisterGeneratedScriptModules();
// Resolve IScriptEngineService to load and execute scripts that call math2.add(1, 2).
Subscribing to server events
Register the Lua events stack, then subscribe from any script by snake_case event name - the
CLR type name minus the Event suffix (EngineStartedEvent becomes engine_started). Payload
keys are snake_case too. The convention applies to every event published on the event bus.
container.RegisterLuaEvents(); // bridge + events module + bus forwarder
events.subscribe("engine_started", function(e)
log.info("engine ready: " .. e.application .. " (" .. e.service_count .. " services)")
end)
The forwarder is a no-op when no event bus is registered. events.on remains available as an
alias of subscribe.
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. |
RegisterScriptModuleAttribute |
Marks script modules for generated registration. |
AddScriptModuleExtension |
RegisterScriptModule<T>() / RegisterLuaUserData<T>(). |
Related
- Tutorial: Scripting with Lua
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.34.0)
- SquidStd.Core (>= 0.34.0)
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 |
|---|---|---|
| 0.41.1 | 55 | 8/5/2026 |
| 0.41.0 | 540 | 7/24/2026 |
| 0.40.1 | 87 | 7/23/2026 |
| 0.40.0 | 295 | 7/21/2026 |
| 0.39.0 | 139 | 7/20/2026 |
| 0.38.0 | 117 | 7/20/2026 |
| 0.37.0 | 207 | 7/17/2026 |
| 0.36.0 | 177 | 7/15/2026 |
| 0.35.0 | 95 | 7/15/2026 |
| 0.34.0 | 100 | 7/14/2026 |
| 0.33.1 | 97 | 7/13/2026 |
| 0.33.0 | 95 | 7/13/2026 |
| 0.32.1 | 96 | 7/13/2026 |
| 0.32.0 | 96 | 7/13/2026 |
| 0.31.0 | 100 | 7/12/2026 |
| 0.30.0 | 94 | 7/12/2026 |
| 0.29.0 | 100 | 7/11/2026 |
| 0.28.0 | 100 | 7/8/2026 |
| 0.27.0 | 111 | 7/7/2026 |
| 0.26.0 | 97 | 7/7/2026 |