r/lua • u/stellar_x • Aug 06 '26
How to include Lua in C
How do include lua in C if I installed it on debian13 with sudo apt install lua5.4?
5
Upvotes
r/lua • u/stellar_x • Aug 06 '26
How do include lua in C if I installed it on debian13 with sudo apt install lua5.4?
5
u/ewmailing Aug 06 '26 edited Aug 06 '26
I'm writing this without a Debian machine to refer to so this might be slightly off, but
sudo apt install liblua5.4-dev#include "lua.h"gcc -I /usr/include/lua5.4 main.c -llua5.4(Edit: Fussing with formatting)
6
u/dan200 Aug 06 '26
#include <lua.h>
2
u/flpezet Aug 06 '26
See the official documentation on C API
1
u/busyHighwayFred Aug 06 '26
Here is a whole video series on just that topic
https://www.youtube.com/watch?v=xrLQ0OXfjaI&list=PLLwK93hM93Z3nhfJyRRWGRXHaXgNX0Itk&index=1
1
u/GenericFoodService Aug 06 '26
Compiler flags:
-llua -lm(alternatively, you can use
pkg-config --libs (library)to get the specific arguments automaticallyThen include it:
-2
u/Radamat Aug 06 '26
I would reccomend to look "sol" library from github