Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edubart/minilua
Single-file port of Lua, a powerful scripting language.
https://github.com/edubart/minilua
c game-development lua minilua scripting-language single-file single-header single-header-lib
Last synced: 3 days ago
JSON representation
Single-file port of Lua, a powerful scripting language.
- Host: GitHub
- URL: https://github.com/edubart/minilua
- Owner: edubart
- License: mit
- Created: 2020-11-27T20:21:28.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-25T15:47:24.000Z (6 months ago)
- Last Synced: 2025-01-29T14:41:53.760Z (3 days ago)
- Topics: c, game-development, lua, minilua, scripting-language, single-file, single-header, single-header-lib
- Language: C
- Homepage:
- Size: 769 KB
- Stars: 270
- Watchers: 9
- Forks: 22
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# MiniLua
This is Lua contained in a single header to be bundled in C/C++ applications with ease.
[Lua](https://www.lua.org/) is a powerful, efficient, lightweight, embeddable scripting language.## Example Usage
```c
#define LUA_IMPL
#include "minilua.h"int main() {
lua_State *L = luaL_newstate();
if(L == NULL)
return -1;
luaL_openlibs(L);
luaL_loadstring(L, "print 'hello world'");
lua_call(L, 0, 0);
lua_close(L);
return 0;
}
```## Usage
Copy `minilua.h` into your C or C++ project, include it anywhere you want to use Lua API.
Then do the following in *one* C file to implement Lua:
```c
#define LUA_IMPL
#include "minilua.h"
```By default it detects the system platform to use, however you can explicitly define one.
Note that almost no modification was made in the Lua implementation code,
thus there are some C variable names that may collide with your code,
therefore it is best to declare the Lua implementation in dedicated C file.Optionally provide the following defines:
- `LUA_MAKE_LUA` - implement the Lua command line REPL## Documentation
For documentation on how to use Lua read its [official manual](https://www.lua.org/manual/).
## Updates
- **25-Jul-2024**: Updated to Lua 5.4.7.
- **13-Nov-2023**: Updated to Lua 5.4.6.
- **28-Jan-2022**: Updated to Lua 5.4.4.
- **31-Mar-2021**: Updated to Lua 5.4.3.
- **03-Dec-2020**: Updated to Lua 5.4.2.
- **27-Nov-2020**: Library created, using Lua 5.4.2-rc1.## Notes
This library tries to keep up with latest official Lua release.
The header is generated using the bash script `gen.sh` all modifications done is there.## License
Same license as Lua, the MIT license, see LICENSE.txt for information.