diff --git a/dist/depends.lua b/dist/depends.lua index bd2cfd6..2a6b7f0 100644 --- a/dist/depends.lua +++ b/dist/depends.lua @@ -327,7 +327,7 @@ local function get_packages_to_install(pkg, installed, manifest, dependency_mani end end - if was_scm_version then pkg.was_scm_version = true end + if pkg and was_scm_version then pkg.was_scm_version = true end -- check arch & type if not err then diff --git a/luadist.lua b/luadist.lua index 0c47b2d..da875dc 100755 --- a/luadist.lua +++ b/luadist.lua @@ -727,7 +727,9 @@ function apply_settings(variable, value) end -- Parse command line input and run the required command. -if not commands[arg[1]] and commands[arg[2]] then +if pcall(debug.getlocal, 4, 1) then + return commands -- return commands when used as module +elseif not commands[arg[1]] and commands[arg[2]] then -- deploy_dir specified return run_command(arg[1], arg[2], 3) elseif commands[arg[1]] then