Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArg = {...}
- function startup()
- local file = fs.open("os/Files/Alias.txt","r")
- local Text = file.readAll()
- local Table = textutils.unserialize(Text)
- for i = 1, #Table do
- shell.setAlias(Table[i][2],Table[i][1])
- end
- file.close()
- end
- function AddAlias(a,b)
- local file = fs.open("os/Files/Alias.txt","r")
- local Text = file.readAll()
- local Table = textutils.unserialize(Text)
- Table[#Table + 1] = {a,b}
- file.close()
- local Doc = fs.open("os/Files/Alias.txt","w")
- Doc.write(textutils.serialize(Table))
- Doc.close()
- end
- function Setup()
- local Table = {{"startup/AliasManager.lua","AliasMan"}}
- local Doc = fs.open("os/Files/Alias.txt","w")
- Doc.write(textutils.serialize(Table))
- Doc.close()
- end
- if tArg[1] == nil then
- startup()
- elseif tArg[1] == "setup" then
- Setup()
- elseif tArg[1] == "add" then
- AddAlias(tArg[2],tArg[3])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement