aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/defaults.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bruiser/defaults.lua32
1 files changed, 18 insertions, 14 deletions
diff --git a/bruiser/defaults.lua b/bruiser/defaults.lua
index 9f9f33b..756ba81 100644
--- a/bruiser/defaults.lua
+++ b/bruiser/defaults.lua
@@ -2,23 +2,27 @@
-- This is run everytime bruiser is called.
-- adds luarocks' path and cpath to bruiser
-local luarocks_handle = io.popen("luarocks path --bin")
-for line in luarocks_handle:lines() do
- local path = string.match(line, "LUA_PATH%s*=%s*('.+')")
- local cpath = string.match(line, "LUA_CPATH%s*=%s*('.+')")
+function default_luarocks_modules()
+ local luarocks_handle = io.popen("luarocks path --bin")
local path_b = false
local cpath_b = false
- if path ~= nil then
- package.path = package.path..path
+ for line in luarocks_handle:lines() do
+ local path = string.match(line, "LUA_PATH%s*=%s*('.+')")
+ local cpath = string.match(line, "LUA_CPATH%s*=%s*('.+')")
+ if path ~= nil then
+ package.path = package.path..";"..path
+ end
+ if cpath ~= nil then
+ package.cpath = package.cpath..";"..cpath
+ end
end
- if cpath ~= nil then
- package.cpath = package.cpath..cpath
+
+ if path_b then
+ io.write("failed to get path from luarocks.\n")
+ end
+ if cpath_b then
+ io.write("failed to get cpath from luarocks.\n")
end
end
-if path_b then
- io.write("failed to get path from luarocks.\n")
-end
-if cpath_b then
- io.write("failed to get cpath from luarocks.\n")
-end
+default_luarocks_modules()