iteration
This commit is contained in:
parent
7aad0ba0e1
commit
c3d3fefd08
23
lib/lum.lua
23
lib/lum.lua
@ -36,10 +36,29 @@ end
|
|||||||
|
|
||||||
function install(package)
|
function install(package)
|
||||||
io.write("Installing " .. package .. "\n")
|
io.write("Installing " .. package .. "\n")
|
||||||
download_lua("packages/" .. package .. ".lua", bin_path .. package .. ".lua")
|
|
||||||
|
local dir = bin_path
|
||||||
|
--if package starts with lib then remove lib
|
||||||
|
if string.sub(package, 1, 3) == "lib" then
|
||||||
|
package = string.sub(package, 5)
|
||||||
|
dir = lib_path
|
||||||
|
end
|
||||||
|
|
||||||
|
download_lua("packages/" .. package .. ".lua", dir .. package .. ".lua")
|
||||||
|
if dir == lib_path then
|
||||||
|
os.loadAPI(lib_path .. package .. ".lua")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function remove(package)
|
function remove(package)
|
||||||
io.write("Removing " .. package .. "\n")
|
io.write("Removing " .. package .. "\n")
|
||||||
fs.delete(bin_path .. package .. ".lua")
|
|
||||||
|
local dir = bin_path
|
||||||
|
--if package starts with lib then remove lib
|
||||||
|
if string.sub(package, 1, 3) == "lib" then
|
||||||
|
package = string.sub(package, 5)
|
||||||
|
dir = lib_path
|
||||||
|
end
|
||||||
|
|
||||||
|
fs.delete(dir .. package .. ".lua")
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user