https://github.com/laserattack/luajit-inline
Allows you to inline the C code in the LuaJIT code
https://github.com/laserattack/luajit-inline
lua luajit luajit-ffi
Last synced: 4 days ago
JSON representation
Allows you to inline the C code in the LuaJIT code
- Host: GitHub
- URL: https://github.com/laserattack/luajit-inline
- Owner: laserattack
- Created: 2025-08-09T15:26:37.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-09T19:36:14.000Z (10 months ago)
- Last Synced: 2026-06-13T13:34:49.098Z (4 days ago)
- Topics: lua, luajit, luajit-ffi
- Language: Lua
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LuaJIT Inline
A very simple small module that allows you to inline C code in LuaJIT code
## Deps
LuaJIT, GCC
## Example
```lua
local inline = require("inline")
inline[[
#include
#include
#include
void my_signal_handler(int signum) {
printf("Custom handler received signal: %d\n", signum);
exit(1);
}
void setup_signal_handler() {
signal(SIGINT, my_signal_handler);
}
int add_numbers(int a, int b) {
return a + b;
}
void print_message(const char* msg) {
printf("Message: %s\n", msg);
}
]]
print(add_numbers(1, 2)) --> 3
print_message("hello from C!") --> Message: hello from C!
setup_signal_handler()
print("press Ctrl+C to exit")
while true do end
```