aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordacctal <donotcontactmevia@email.invalid>2026-06-22 18:42:08 +0000
committerdacctal <donotcontactmevia@email.invalid>2026-06-22 18:42:08 +0000
commitb8512ce0730e1575f4329e3b78a1540e5228d4f0 (patch)
treef1225035e9fa11510284b2ac48815f22d47bfd04 /src
parenta18b7108f1648dc69e06bb21e84ec48a2dd60f60 (diff)
i fixed the rest of the install functions
Diffstat (limited to 'src')
-rw-r--r--src/lua_state.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/src/lua_state.c b/src/lua_state.c
index fcaf90c..435d602 100644
--- a/src/lua_state.c
+++ b/src/lua_state.c
@@ -205,11 +205,18 @@ bool target_loop_install(lua_State *L, const char* lua_file, const char *target)
"%s %s: 'targets.%s.pre_install' is not a function.\n",
print_warning, lua_file, target
);
- } else if (lua_pcall(L, 0, 0, 0) != LUA_OK) {
+ } else if (lua_pcall(L, 0, 1, 0) != LUA_OK) {
if (is_verbose) printf(
- "%s %s: 'targets.%s.pre_install' failed: %s\n",
+ "%s %s: 'targets.%s.pre_install' function borked: %s\n",
print_warning, lua_file, target, lua_tostring(L, -1)
);
+ if (!lua_isnumber(L, -1) || lua_tonumber(L, -1) != 0) if (is_verbose) {
+ printf(
+ "%s %s: 'targets.%s.pre_install' failed: %s\n",
+ print_error, lua_file, target, lua_tostring(L, -1)
+ );
+ return false;
+ }
}
lua_pop(L, 1);
lua_getfield(L, -1, "install");
@@ -223,12 +230,20 @@ bool target_loop_install(lua_State *L, const char* lua_file, const char *target)
}
if (lua_pcall(L, 0, 0, 0) != LUA_OK) {
if (is_verbose) printf(
- "%s %s: 'targets.%s.install' failed: %s\n",
+ "%s %s: 'targets.%s.install' function borked: %s\n",
print_warning, lua_file, target, lua_tostring(L, -1)
);
lua_pop(L, 1);
return false;
}
+ if (!lua_isnumber(L, -1) || lua_tonumber(L, -1) != 0) if (is_verbose) {
+ printf(
+ "%s %s: 'targets.%s.install' failed: %s\n",
+ print_error, lua_file, target, lua_tostring(L, -1)
+ );
+ lua_pop(L, 1);
+ return false;
+ }
lua_pop(L, 1);
lua_getfield(L, -1, "post_install");
if (!lua_isfunction(L, -1)) {
@@ -238,9 +253,15 @@ bool target_loop_install(lua_State *L, const char* lua_file, const char *target)
);
} else if (lua_pcall(L, 0, 0, 0) != LUA_OK) {
if (is_verbose) printf(
- "%s %s: 'targets.%s.post_install' failed: %s\n",
+ "%s %s: 'targets.%s.post_install' function borked: %s\n",
print_warning, lua_file, target, lua_tostring(L, -1)
);
+ if (!lua_isnumber(L, -1) || lua_tonumber(L, -1) != 0) if (is_verbose) {
+ printf(
+ "%s %s: 'targets.%s.post_install' failed: %s\n",
+ print_error, lua_file, target, lua_tostring(L, -1)
+ );
+ }
}
lua_pop(L, 1);
return true;
@@ -267,12 +288,20 @@ bool target_loop_uninstall(lua_State *L, const char *lua_file, const char *targe
}
if (lua_pcall(L, 0, 0, 0) != LUA_OK) {
if (is_verbose) printf(
- "%s %s: 'targets.%s.uninstall' failed: %s\n",
+ "%s %s: 'targets.%s.uninstall' function borked: %s\n",
print_warning, lua_file, target, lua_tostring(L, -1)
);
lua_pop(L, 1);
return false;
}
+ if (!lua_isnumber(L, -1) || lua_tonumber(L, -1) != 0) if (is_verbose) {
+ printf(
+ "%s %s: 'targets.%s.uninstall' failed: %s\n",
+ print_error, lua_file, target, lua_tostring(L, -1)
+ );
+ lua_pop(L, 1);
+ return false;
+ }
lua_pop(L, 1);
return true;
}