Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function filecopyblock(cfrom, cto, ctarg, cdest)
- self.Copyfrom = ("data/" .. cfrom)
- self.Copyto = ("data/" .. cto)
- self.Targname = ctarg
- self.Destname = cdest
- if (self.Copyfrom == nil) then
- ba.print("Invalid variable 'copyfrom' in filecopy function...\n")
- end
- if (self.Copyto == nil) then
- ba.print("Invalid variable 'copyto' in filecopy function...\n")
- end
- if (self.Targname == nil) then
- ba.print("Invalid variable 'targname' in filecopy function...\n")
- end
- if (self.Destname == nil) then
- ba.print("Invalid variable 'destname' in filecopy function...\n")
- end
- if ((self.Copyfrom ~= nil) and (self.Copyto ~= nil) and (self.Targname ~= nil) and (self.Destname ~= nil)) then
- local file = cf.openFile(self.Targname, "r", self.Copyfrom)
- local mstring = file:read("*a")
- file:close()
- file = cf.openFile(self.Destname, "w+", self.Copyto)
- file:write(mstring)
- file:close()
- else
- ba.print("Warning: One or more necessary variables for filecopy function were nil! Operation cancelled...\n")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement