Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Conditional Hooks
- $Application: FS2_Open
- $On Game Init: [
- --table for moving files around
- function cpyfr(cpyfrpass)
- copyfrom = ("data/" .. cpyfrpass)
- end
- function cpyto(cpytopass)
- copyto = ("data/" .. cpytopass)
- end
- function cpyt(targname)
- end
- function cpyd(destname)
- end
- function copy()
- if (copyfrom == nil) then
- ba.print("Invalid variable 'copyfrom' in filecopy function...\n")
- end
- if (copyto == nil) then
- ba.print("Invalid variable 'copyto' in filecopy function...\n")
- end
- if (targname == nil) then
- ba.print("Invalid variable 'targname' in filecopy function...\n")
- end
- if (destname == nil) then
- ba.print("Invalid variable 'destname' in filecopy function...\n")
- end
- if ((copyfrom ~= nil) and (copyto ~= nil) and (targname ~= nil) and (destname ~= nil)) then
- local file = cf.openFile(targname, "r", copyfrom)
- local mstring = file:read("*a")
- file:close()
- file = cf.openFile(destname, "w+", 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
- ]
- #end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement