Proper pkg-config and error handling on script load

This commit is contained in:
Casey 2024-04-09 23:36:59 +03:00
parent 4a00d26cb9
commit 7975b92532
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,5 @@
CFLAGS +=
LDFLAGS := -lm -lcairo -lxcb -llua5.3
CFLAGS += `pkg-config --cflags cairo xcb lua53`
LDFLAGS := `pkg-config --libs cairo xcb lua53`
OBJECTS := obj/common.o obj/rootwindow.o obj/cairo_context.o obj/api_draw.o
livewp: lib

View File

@ -32,8 +32,13 @@ int main(void) {
global_context.lua = luaL_newstate();
luaL_openlibs(global_context.lua);
loadapi_draw(global_context.lua);
if (luaL_dofile(global_context.lua, "example.lua") == LUA_OK) {
lua_pop(global_context.lua, lua_gettop(global_context.lua));
} else {
printf("ERROR: %s\n", lua_tostring(global_context.lua, lua_gettop(global_context.lua)));
lua_pop(global_context.lua, lua_gettop(global_context.lua));
return EXIT_FAILURE;
}