aboutsummaryrefslogtreecommitdiff
path: root/src/lua_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua_state.c')
-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;
}