Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- RunServer Program:
- -- By KillaVanilla
- local servers = {}
- -- Check and load servers in "servers/" (and load parameters):
- for i=1, #fs.list("servers/") do
- local paramListFile = io.open("parameters/"..fs.list("servers/")[i], "r")
- local paramList = {}
- for line in paramListFile:lines() do
- for parameter in string.gmatch(line, "([%w%p%S]+)%s+") do
- table.insert(paramList, parameter)
- end
- end
- local fn = function() shell.run("servers/"..fs.list("servers/")[i], unpack(parameters)) end
- table.insert(servers, fn)
- end
- -- actually run the servers and CraftOS / whatever OS the end-user happens to be using:
- if not _G["startupRun"] then
- _G["startupRun"] = true
- if fs.exists("servers/startup") then
- parallel.waitForAll(function() shell.run("servers/startup") end, unpack(servers))
- else
- parallel.waitForAll(function() shell.run("shell") end, unpack(servers))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement