minilua.c 5.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +22 -0
- package/README.md +82 -0
- package/minilua.h +29348 -0
- package/package.json +15 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 1994–2019 Lua.org, PUC-Rio.
|
|
4
|
+
Copyright (c) 2020-2023 Eduardo Bart (https://github.com/edubart).
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# MiniLua
|
|
2
|
+
|
|
3
|
+
This is Lua contained in a single header to be bundled in C/C++ applications with ease.
|
|
4
|
+
[Lua](https://www.lua.org/) is a powerful, efficient, lightweight, embeddable scripting language.
|
|
5
|
+
This library was created by [Eduardo Bart](https://github.com/edubart).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Run:
|
|
10
|
+
```bash
|
|
11
|
+
$ npm i minilua.c
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
And then include `minilua.h` as follows:
|
|
15
|
+
```c
|
|
16
|
+
#include "node_modules/minilua.c/minilua.h"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Example Usage
|
|
20
|
+
|
|
21
|
+
```c
|
|
22
|
+
#define LUA_IMPL
|
|
23
|
+
#include "minilua.h"
|
|
24
|
+
|
|
25
|
+
int main() {
|
|
26
|
+
lua_State *L = luaL_newstate();
|
|
27
|
+
if(L == NULL)
|
|
28
|
+
return -1;
|
|
29
|
+
luaL_openlibs(L);
|
|
30
|
+
luaL_loadstring(L, "print 'hello world'");
|
|
31
|
+
lua_call(L, 0, 0);
|
|
32
|
+
lua_close(L);
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
Include `minilua.h` to use Lua API.
|
|
40
|
+
Then do the following in *one* C file to implement Lua:
|
|
41
|
+
```c
|
|
42
|
+
#define LUA_IMPL
|
|
43
|
+
#include "minilua.h"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
By default it detects the system platform to use, however you can explicitly define one.
|
|
47
|
+
|
|
48
|
+
Note that almost no modification was made in the Lua implementation code,
|
|
49
|
+
thus there are some C variable names that may collide with your code,
|
|
50
|
+
therefore it is best to declare the Lua implementation in dedicated C file.
|
|
51
|
+
|
|
52
|
+
Optionally provide the following defines:
|
|
53
|
+
- `LUA_MAKE_LUA` - implement the Lua command line REPL
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
For documentation on how to use Lua read its [official manual](https://www.lua.org/manual/).
|
|
58
|
+
|
|
59
|
+
## Updates
|
|
60
|
+
|
|
61
|
+
- **25-Jul-2024**: Updated to Lua 5.4.7.
|
|
62
|
+
- **13-Nov-2023**: Updated to Lua 5.4.6.
|
|
63
|
+
- **28-Jan-2022**: Updated to Lua 5.4.4.
|
|
64
|
+
- **31-Mar-2021**: Updated to Lua 5.4.3.
|
|
65
|
+
- **03-Dec-2020**: Updated to Lua 5.4.2.
|
|
66
|
+
- **27-Nov-2020**: Library created, using Lua 5.4.2-rc1.
|
|
67
|
+
|
|
68
|
+
## Notes
|
|
69
|
+
|
|
70
|
+
This library tries to keep up with latest official Lua release.
|
|
71
|
+
The header is generated using the bash script `gen.sh` all modifications done is there.
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
Same license as Lua, the MIT license, see LICENSE.txt for information.
|
|
76
|
+
|
|
77
|
+
<br>
|
|
78
|
+
<br>
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
[](https://nodef.github.io)
|
|
82
|
+

|