Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ state.Environment["add"] = new LuaFunction((context, ct) =>

// Set the return value to the context
context.Return(arg0 + arg1);

// If there are multiple values, you need to pass them together as follows.
// context.Return(arg0, arg1);
// context.Return([arg0, arg1]);
Expand Down Expand Up @@ -459,7 +459,7 @@ public partial class LuaVector3
vector = a.vector + b.vector
};
}

[LuaMetamethod(LuaObjectMetamethod.Sub)]
public static LuaVector3 Sub(LuaVector3 a, LuaVector3 b)
{
Expand Down Expand Up @@ -621,6 +621,48 @@ With `UnityStandardIO`, standard output such as `print` will be output to `Debug

These are simple implementations only, so for actual use it is recommended creating your own implementations as needed.

## Development

The repository uses the .NET SDK and can be built from the repo root.

### Build

```sh
dotnet build Lua.slnx -c Release
```

If you only want to build the NuGet package project:

```sh
dotnet build src/Lua/Lua.csproj -c Release
```

### Run Tests

```sh
dotnet test tests/Lua.Tests/Lua.Tests.csproj -c Release
```

### Inherited Lua Tests

The test project includes a set of `.lua` conformance-style tests inherited from the official Lua repository. Most of them are expected to pass, but a few known cases are currently marked with the `ExpectedFailure` category in the test suite.

To run the test project while excluding those known failures:

```sh
dotnet test tests/Lua.Tests/Lua.Tests.csproj -c Release --filter "TestCategory!=ExpectedFailure"
```

This is the same filter used in GitHub Actions when packing and publishing the NuGet package.

### Pack for NuGet

```sh
dotnet pack src/Lua/Lua.csproj -c Release -o ./artifacts/nuget
```

The package version is defined in `Directory.Build.props`. After packing, the `.nupkg` file will be written to `artifacts/nuget/`.

## Compatibility

Lua-CSharp is designed with integration into .NET in mind, so there are several differences from the C implementation.
Expand Down