aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordacctal <dacctal@symlinx.net>2026-06-09 04:30:17 +0000
committerdacctal <dacctal@symlinx.net>2026-06-09 04:30:17 +0000
commit1291765390a328610b64f76bd11269aff1cb03b5 (patch)
treed8652abfe472d73949cd0269adedb0e1bde19f21
parent5ad991b39e5033bde061ded2234192f7f1cb70ad (diff)
pre_install doesn't break the program if it doesn't exist
-rw-r--r--src/lua_state.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/lua_state.c b/src/lua_state.c
index c9ea5e3..51b070f 100644
--- a/src/lua_state.c
+++ b/src/lua_state.c
@@ -126,7 +126,7 @@ bool repo_build(const char *repository) {
}
lua_getfield(L, -1, repository);
if (!lua_istable(L, -1)) {
- if (is_verbose) printf("%s'repositories' lua variable '%s' is not a table.\n", print_warning, repository);
+ if (is_verbose) printf("%s'repositories.%s' is not a table.\n", print_warning, repository);
lua_pop(L, 2);
return false;
}
@@ -134,8 +134,8 @@ bool repo_build(const char *repository) {
lua_getfield(L, -1, "dependencies");
if (!lua_istable(L, -1)) {
if (is_verbose) printf(
- "%s'repositories' variable 'dependencies' is not a table.\n",
- print_warning
+ "%s'repositories.%s.dependencies' is not a table.\n",
+ print_warning, repository
);
} else {
lua_pushnil(L);
@@ -146,8 +146,8 @@ bool repo_build(const char *repository) {
lua_getfield(L, -1, "build");
if (!lua_isfunction(L, -1)) {
if (is_verbose) printf(
- "%s'repositories' lua variable 'build' is not a function.\n",
- print_warning
+ "%s'repositories.%s.build' is not a function: %s\n",
+ print_warning, repository, lua_tostring(L, -1)
);
lua_pop(L, 3);
return false;
@@ -171,18 +171,24 @@ bool repo_install(const char *repository) {
}
lua_getfield(L, -1, repository);
if (!lua_istable(L, -1)) {
- if (is_verbose) printf("%s'repositories' lua variable '%s' is not a table.\n", print_warning, repository);
+ if (is_verbose) printf("%s'repositories.%s' is not a table.\n", print_warning, repository);
lua_pop(L, 2);
return false;
}
lua_getfield(L, -1, "pre_install");
if (!lua_isfunction(L, -1)) {
- if (is_verbose) printf("%s'repositories' lua variable 'pre_install' is not a function.\n", print_warning);
- }
- if (lua_pcall(L, 0, 0, 0) != LUA_OK) {
- if (is_verbose) printf("%s'repositories' pre_install failed: %s\n", print_warning, lua_tostring(L, -1));
+ if (is_verbose) printf(
+ "%s'repositories.%s.pre_install' is not a function.\n",
+ print_warning, repository
+ );
+ } else if (lua_pcall(L, 0, 0, 0) != LUA_OK) {
+ if (is_verbose) printf(
+ "%s'repositories.%s.pre_install' failed: %s\n",
+ print_warning, repository, lua_tostring(L, -1)
+ );
}
+ lua_pop(L, 1);
lua_getfield(L, -1, "install");
if (!lua_isfunction(L, -1)) {