Posted 21 February 2015 - 05:05 AM
local tArgs = { ... }
rednet.open("back")
function getlist(tdir)
-- Get all the files in the directory
local sDir = shell.dir()
if tdir ~= nil then
sDir = shell.resolve( tdir )
end
-- Sort into dirs/files, and calculate column count
local tAll = fs.list( sDir )
local tFiles = {}
local tDirs = {}
for n, sItem in pairs( tAll ) do
if string.sub( sItem, 1, 1 ) ~= "." then
local sPath = fs.combine( sDir, sItem )
if fs.isDir( sPath ) then
table.insert( tDirs, sItem )
else
table.insert( tFiles, sItem )
end
end
end
table.sort( tDirs )
table.sort( tFiles )
a = textutils.pagedTabulate( colors.green, tDirs, colors.white, tFiles)
rednet.broadcast(a, ":ftp:text", "incoming")
end
function transferFile(xFile)
if fs.exists(xFile) then
z = fs.open(xFile, "r")
y = z.readAll()
z.close()
rednet.broadcast(y .. ":ftp:fileincoming", "incoming")
else
x = "file does not exist"
rednet.broadcast(x .. ":ftp:text", "incoming")
end
end
function recieveFile(mFile)
g = string.match(mFile, "(%b<>)")
g = string.gsub(g, "<", "")
g = string.gsub(g, ">", "")
print(g)
uFile = mFile:gsub("<" .. g .. ">", "")
ow, err = fs.open(g, "w")
print(err)
ow.write(uFile)
ow.flush()
ow.close()
print(g .. " " .. mFile)
end
recieveFile("<hi>Hello")
while true do
senderID, msg, dis, protocol = rednet.receive("outgoing", 50)
end
Line of code erroring for NO REASON
error: attemp to index ? a nil value
Edited by