Skip to content
Closed
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ The extension package for Unity is located in the `Assets/Lua.Unity` directory w

The Unity package does not include the source code of the core package. During development, a local package containing the debug DLL is added as `com.nuskey8.lua.unity.internal`.

For `[LuaObject]` bindings, the local package also needs `Lua.Annotations.dll` and
`Lua.SourceGenerator.dll`, built separately from their projects.

## Publishing Packages

Publishing to NuGet is handled by a workflow via GitHub Actions. This will run whenever you push a `v.*.*.*` tag.
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ dotnet add package LuaCSharp
Install-Package LuaCSharp
```

The runtime package does not depend on the official source generator or its annotations.
To use `[LuaObject]`, also install both packages at the same version as `LuaCSharp`:

```ps1
dotnet add package LuaCSharp.Annotations
dotnet add package LuaCSharp.SourceGenerator
```

Existing projects using `[LuaObject]` must add these explicit references when upgrading.

### Unity

You can also use Lua-CSharp with Unity. For details, see the [Lua.Unity](#luaunity) section.
Expand Down Expand Up @@ -367,6 +377,9 @@ for (int i = 0; i < 10; i++)

## LuaObject

Requires the optional `LuaCSharp.Annotations` and `LuaCSharp.SourceGenerator` packages
described in [Installation](#installation).

By applying the `[LuaObject]` attribute, you can create custom classes that run within Lua. Adding this attribute to a class that you wish to use in Lua allows the Source Generator to automatically generate the code required for interaction from Lua.

The following is an example implementation of a wrapper class for `System.Numerics.Vector3` that can be used in Lua:
Expand Down Expand Up @@ -619,6 +632,9 @@ Lua-CSharp can also be used in Unity (works with both Mono and IL2CPP).

2. Open the NuGet window by going to `NuGet > Manage NuGet Packages`, search for the `LuaCSharp` package, and install it.

For `[LuaObject]` bindings, also install `LuaCSharp.Annotations` and
`LuaCSharp.SourceGenerator` at the same version. Custom bindings only require the runtime.

3. Open the Package Manager window by selecting `Window > Package Manager`, then click on `[+] > Add package from git URL` and enter the following URL:

```
Expand Down
15 changes: 15 additions & 0 deletions README_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ dotnet add package LuaCSharp
Install-Package LuaCSharp
```

ランタイムパッケージは公式Source Generatorと属性パッケージに依存しません。
`[LuaObject]`を使用する場合は、`LuaCSharp`と同じバージョンの次のパッケージも明示的に追加してください。
既存の`[LuaObject]`利用プロジェクトも、アップグレード時に追加が必要です。

```ps1
dotnet add package LuaCSharp.Annotations
dotnet add package LuaCSharp.SourceGenerator
```

### Unity

Lua-CSharpをUnityで利用することも可能です。詳細は[Lua.Unity](#luaunity)の項目を参照してください。
Expand Down Expand Up @@ -365,6 +374,9 @@ for (int i = 0; i < 10; i++)

## LuaObject

利用には[インストール](#インストール)で説明した`LuaCSharp.Annotations`と
`LuaCSharp.SourceGenerator`の追加が必要です。

`[LuaObject]`属性を用いることで、Lua上で動作する独自のクラスを作成することが可能になります。Luaで使いたいクラスにこの属性を付加することで、Source GeneratorがLua側から利用されるコードを自動生成します。

以下のサンプルコードはLuaで動作する`System.Numerics.Vector3`のラッパークラスの実装例です。
Expand Down Expand Up @@ -586,6 +598,9 @@ Lua-CSharpはUnityで利用することも可能です。(Mono/IL2CPPの両方

2. `NuGet > Manage NuGet Packages`からNuGetウィンドウを開き、`LuaCSharp`パッケージを検索してインストールします。

`[LuaObject]`を使用する場合は、同じバージョンの`LuaCSharp.Annotations`と
`LuaCSharp.SourceGenerator`もインストールしてください。

3. `Window > Package Manager`からPackage Managerウィンドウを開き、`[+] > Add package from git URL`から以下のURLを入力します。
```
https://github.com/nuskey8/Lua-CSharp.git?path=src/Lua.Unity/Assets/Lua.Unity
Expand Down
5 changes: 0 additions & 5 deletions src/Lua/Lua.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,4 @@
<None Include="..\..\README.md" Pack="true" PackagePath="README.md" />
<EmbeddedResource Include="..\..\LICENSE" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Lua.SourceGenerator\Lua.SourceGenerator.csproj" />
<ProjectReference Include="..\Lua.Annotations\Lua.Annotations.csproj" />
</ItemGroup>
</Project>
Loading