|
1 | 1 | # Lua.NET |
2 | 2 |  |
3 | 3 |
|
4 | | -C# .NET Core 7.0 |
| 4 | +C# .NET Core 8.0 |
5 | 5 | Lua.NET contains full bindings to Lua5.1.5, Lua5.2.4, Lua5.3.6, Lua.5.4.6 and LuaJIT |
6 | 6 |
|
7 | 7 | https://github.com/tilkinsc/Lua.NET |
8 | 8 | Copyright © Cody Tilkins 2023 MIT License |
9 | 9 |
|
10 | 10 | Supports Lua5.4 Lua5.3 Lua5.2 Lua5.1 and LuaJIT |
11 | 11 |
|
12 | | -Hardcoded to only use doubles and 64-bit integers. |
13 | | -This CAN be changed with manual edits, but it wasn't fun writing this library. |
14 | | -This code was made with with the default includes on a 64-bit windows 10 machine using Lua's and LuaJIT's makefiles. |
15 | | -No DLL has to be built for this library as its included for you. |
16 | | - |
17 | | -Custom DLLs are supported as long as they don't change any call arguments or return values. |
| 12 | +Hardcoded to only use doubles and 64-bit integers. |
| 13 | +No DLL has to be built for this library as its included for you. |
| 14 | +Windows only. Linux is not supported, yet. |
| 15 | +Custom DLLs are supported when building from source; they must retain backwards compatibility with Lua. |
18 | 16 |
|
19 | 17 | # Design Considerations / Usage |
20 | 18 |
|
21 | | -Your delegates you pass to functions such as `lua_pushcfunction(...)` should be static. |
22 | | -If you do not use static, then the lifetime of your functions should exceed the lifetime of the Lua the final Lua context you create during the course of the program. |
23 | | -Do not use lambdas. |
24 | | -C# is liable to GC your delegates otherwise. |
| 19 | +The delegates you pass to functions such as `lua_pushcfunction(...)` should be static. |
| 20 | +Otherwise, the lifetime of your functions should exceed the lifetime of the lua_State. |
| 21 | +Do not use lambdas, as C# is liable to GC them. |
| 22 | +A system to support lambdas may be added in the future, but it requires tracking lambda references. |
25 | 23 |
|
26 | 24 | # Examples |
27 | 25 |
|
@@ -51,7 +49,7 @@ public class Test1 |
51 | 49 | public static void Main(String[] args) |
52 | 50 | { |
53 | 51 | lua_State L = luaL_newstate(); |
54 | | - if (L.Handle == 0) |
| 52 | + if (L == 0) |
55 | 53 | { |
56 | 54 | Console.WriteLine("Unable to create context!"); |
57 | 55 | } |
@@ -92,7 +90,7 @@ public class Test2 |
92 | 90 | public static void Main(String[] args) |
93 | 91 | { |
94 | 92 | lua_State L = luaL_newstate(); |
95 | | - if (L.Handle == 0) |
| 93 | + if (L == 0) |
96 | 94 | { |
97 | 95 | Console.WriteLine("Unable to create context!"); |
98 | 96 | } |
@@ -168,7 +166,7 @@ public class Test4 |
168 | 166 | public static void Main(string[] args) |
169 | 167 | { |
170 | 168 | lua_State L = luaL_newstate(); |
171 | | - if (L.Handle == 0) |
| 169 | + if (L == 0) |
172 | 170 | { |
173 | 171 | Console.WriteLine("Unable to create context!"); |
174 | 172 | } |
|
0 commit comments