You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-4
Original file line number
Diff line number
Diff line change
@@ -16,14 +16,34 @@ Hardcoded to only use doubles and 64-bit integers.
16
16
17
17
The delegates you pass to functions such as `lua_pushcfunction(...)` should be static.
18
18
Otherwise, the lifetime of your functions should exceed the lifetime of the lua_State.
19
-
Do not use lambdas, as C# is liable to GC them.
20
-
A system to support lambdas may be added in the future, but it requires tracking lambda references.
19
+
Do not use non-static lambdas, as C# is liable to GC them.
20
+
You may get away with non-static lambdas if you track their references.
21
+
When you track lambda references they should be cleaned up with the destruction of the lua_State.
22
+
A system to support lambdas may be added in the future.
23
+
24
+
Acceptable lua_CFunction Pointers:
25
+
```C#
26
+
[UnmanagedCallersOnly]
27
+
publicstaticintlfunc(lua_StateL)
28
+
{
29
+
...
30
+
return0;
31
+
}
32
+
...
33
+
lua_pushcfunction(L, lfunc);
34
+
```
35
+
```C#
36
+
lua_pushcfunction(L, static (L) => {
37
+
...
38
+
return0;
39
+
});
40
+
```
21
41
22
42
# Shared Libraries
23
43
24
44
No shared library has to be built for this library, as its included for you.
25
45
Custom DLLs are supported when building from source; they must retain ABI compatibility with Lua.
26
-
If using custom shared libraries, you will need to replace the repsective shared library Nuget gives you locally in your project in `bin/{configuration}/{target}/runtimes/{platform-rid}/native`. The name must be the same as the one you are replacing. The ideal way to handle this is by rolling your own nuget package clone of this repository. The reason for this is a shortcoming of runtime dlls not being copied over in project references (as opposed to package reference from nuget). All of this can be avoided if you change the DllName inside the respective source, however, that solution adds complexity to your project. Nuget packages are easy.
46
+
If using custom shared libraries, you will need to replace the respective shared library Nuget gives you locally in your project in `bin/{configuration}/{target}/runtimes/{platform-rid}/native`. The name must be the same as the one you are replacing. The ideal way to handle this is by rolling your own nuget package clone of this repository. The reason for this is a shortcoming of runtime dlls not being copied over in project references (as opposed to package reference from nuget). All of this can be avoided if you change the DllName inside the respective source, however, that solution adds complexity to your project. Nuget packages are easy.
0 commit comments