File tree Expand file tree Collapse file tree 8 files changed +847
-29
lines changed Expand file tree Collapse file tree 8 files changed +847
-29
lines changed Original file line number Diff line number Diff line change 16
16
3rdlibs /LuaJIT /src /host /buildvm_arch.h
17
17
3rdlibs /LuaJIT /src /host /minilua
18
18
3rdlibs /LuaJIT /src /jit /vmdef.lua
19
+
20
+
21
+ build /
22
+ build * /
23
+ binding /
24
+
Original file line number Diff line number Diff line change 1
- ## Node-luajit binding
1
+
2
+ ## Node-luajit binding
3
+
4
+ support npai version 6(node minimum version v10.20.0).
5
+
6
+ need lower version check the branch 8.x-10.x or 6.x.
7
+
8
+
2
9
#### Cross platform. (win,mac,linux)[ x64]
3
10
similar as ` https://github.com/brettlangdon/NodeLua `
4
11
@@ -12,6 +19,7 @@ similar as `https://github.com/brettlangdon/NodeLua`
12
19
5 . add,linux auto compile luajit.[ 2018-01-29] http://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz
13
20
6 . add, cjson compile and auto load. [ 2018-01-29] https://github.com/openresty/lua-cjson/archive/master.zip
14
21
7 . > win64 need fix.
22
+ 8 . support napi. support node 10.20.x-14.x [ 2021-01-06]
15
23
16
24
17
25
##Installation
@@ -23,7 +31,8 @@ npm install node-luajit --unsafe-perm
23
31
24
32
```
25
33
26
- #### node 8.x 10.x:
34
+ #### node napi
35
+
27
36
Linux build luajit
28
37
```
29
38
git clone https://github.com/LuaJIT/LuaJIT.git
Original file line number Diff line number Diff line change 1
1
{
2
2
"targets" : [
3
3
{
4
- "target_name" : "node-luajit " ,
4
+ "target_name" : "<(module_name) " ,
5
5
"variables" : {
6
6
"lua_include" : "" ,
7
7
"lib_dirs" : ""
86
86
"3rdlibs/lua-cjson/lua_cjson.c" ,
87
87
"3rdlibs/lua-cjson/strbuf.c"
88
88
],
89
- "include_dirs" : [
90
- "<!@(node -p \" require('node-addon-api').include\" )"
91
- ],
92
- 'defines' : [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
93
- }
89
+ "include_dirs" : [
90
+ "<!@(node -p \" require('node-addon-api').include\" )"
91
+ ],
92
+ "dependencies" : [
93
+ "<!(node -p \" require('node-addon-api').gyp\" )"
94
+ ],
95
+ "defines" : [
96
+ "NAPI_VERSION=<(napi_build_version)" ,
97
+ "NAPI_DISABLE_CPP_EXCEPTIONS" ,
98
+ ]
99
+ },
100
+ {
101
+ "target_name" : "action_after_build" ,
102
+ "type" : "none" ,
103
+ "dependencies" : [ "<(module_name)" ],
104
+ "copies" : [
105
+ {
106
+ "files" : [ "<(PRODUCT_DIR)/<(module_name).node" ],
107
+ "destination" : "<(module_path)"
108
+ }
109
+ ]
110
+ }
94
111
]
95
112
}
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
- let nodelua = null ;
3
2
let path = require ( 'path' ) ;
4
- try {
5
- nodelua = require ( './build/Release/node-luajit' ) ;
6
- } catch ( e ) {
7
- console . log ( '``` release load err:' , e ) ;
8
- try {
9
- nodelua = require ( './build/Debug/node-luajit' ) ;
10
- } catch ( e ) {
11
- nodelua = require ( '/Users/nuc/Library/Developer/Xcode/DerivedData/binding-ebwzqyofwzjwfzcrbpisobhcazli/Build/Products/Debug/node-luajit.node' )
12
- }
13
- }
3
+ const binary = require ( 'node-pre-gyp' ) ;
4
+ const binding_path = binary . find ( path . resolve ( path . join ( __dirname , 'package.json' ) ) ) ;
5
+ const nodelua = require ( binding_path ) ;
14
6
15
7
let MyCLua = nodelua [ 'MyLuaState' ] ;
16
8
You can’t perform that action at this time.
0 commit comments