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
- Added luajit local test folder to gitignore
- Reworded and reformatted README.md
Updated examples for new changes present in this commit
- In all Lua versions, fixed oversight where:
- Returned function pointers were not nullable
- Sending null function pointers sent Nullable<T> rather than T
- It was not possible to send null pointers some places
which are handled gracefully by the lua api
Hardcoded to only use doubles and 64-bit integers, so the Lua library will have to be built accordingly. This CAN be changed with manual edits, but it wasn't fun writing this library. This code was made with with the default includes on a 64-bit windows 10 machine using Lua's makefile and LuaJIT. All DLL's are named differently, make sure the name of the Lua dll matches that of the .cs file; will make it easier in the future.
11
+
Hardcoded to only use doubles and 64-bit integers, so the Lua library will have to be built accordingly.
12
+
This CAN be changed with manual edits, but it wasn't fun writing this library.
13
+
This code was made with with the default includes on a 64-bit windows 10 machine using Lua's makefile and LuaJIT.
14
+
All DLL's are named differently, make sure the name of the Lua dll matches that of the .cs file; will make it easier in the future and provide the DLLs for you.
16
15
```
17
16
Lua5.4 - lua544.dll
18
17
Lua5.3 - lua536.dll
@@ -21,16 +20,42 @@ Lua5.1 - lua515.dll
21
20
LuaJIT - lua51.dll
22
21
```
23
22
23
+
Custom DLLs are supported as long as they don't change any call arguments or return values.
24
+
25
+
To build Lua, get the Lua source from [Lua.org](https://www.lua.org/download.html) or [LuaJIT](https://luajit.org/download.html).
26
+
```bat
27
+
make -j24
28
+
```
29
+
Then rename the dll to the above convention.
30
+
31
+
# Design Considerations / Usage
32
+
33
+
Your delegates you pass to functions such as `lua_pushcfunction(...)` should be static.
34
+
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.
35
+
Do not use lambdas.
36
+
C# is liable to GC your delegates otherwise.
37
+
38
+
There are functions prefixed with an underscore.
39
+
These functions denote raw DllImported functions.
40
+
The reason these exist is because some functions needed a shim function for it to work properly/sanely, i.e. marshaling.
41
+
You can write your own functions against those.
42
+
For example, if you want a function like lua_pcall but not have to specify an error handler offset you can invoke _lua_pcall(...) in a util class (all functions are static).
43
+
This library does not use unsafe, however, going unsafe should work perfectly.
44
+
If you are just here to use the library, you can get by without having to worry about the underscore prefixed functions.
0 commit comments