I was taught when I was doing C/C++ in college, that extra lines that can be removed should be removed, if removing them doesnt effect the end result. My point is that if you move a file over another file, it will overwrite the file, and no deletion is needed.
to make the process simple, try something along the lines of this(I have not tested this, as I am writing this code on the fly, and am not near my xbox.)
scriptTitle = "Whatever you want to call it"
scriptAuthor = "Your name here"
scriptVersion = 1
scriptDescription = "Describe your script here"
scriptIcon = "icon.png";
scriptPermissions = { "filesystem" }
function main()
local TOcestinoMAIN = "Xbox360\\System\\Hdd1\\GTA San Andreas Biohazard\\data\\script\\main.scm";
local TOcestinoSCRIPT = "Xbox360\\System\\Hdd1\\GTA San Andreas Biohazard\\data\\script\\script.img";
local TOmainDEL = "Xbox360\\System\\Usb0\\main.scm"
local TOscriptDEL = "Xbox360\\System\\Usb0\\script.img"
if FileSystem.FileExists(TOcestinoMAIN) then
FileSystem.DeleteFile( TOcestinoMAIN );
end
if FileSystem.FileExists(TOcestinoSCRIPT) then
FileSystem.DeleteFile( TOcestinoSCRIPT );
end
wait(1);
if FileSystem.FileExists(TOmainDEL) then
FileSystem.MoveFile(TOmainDEL .TOcestinoMAIN , 1 );
end
if FileSystem.FileExists(TOscriptDEL) then
FileSystem.MoveFile(TOscriptDEL .TOcestinoSCRIPT , 1 );
end
end
A little debugging, and maybe some tabbing for readablity(I dont think LUA is like python, where tab spacing matters, but it isnt a language I really use much) You could also cut down a decent amount of code, running the file exist if statements in a loop(maybe?) not sure there, as I cant test this, and dont really feel like doing the work for you. Most of this work was copy and paste, between the java you have above, and a the xbox unity github scripts. At the very least it is a starting point for you. The aurora debug app, is really helpful to debug scripts like this, and if you felt so inclined, I would suggest adding error checking for the file operations, and some sort of notifications, especially if you plan on releasing this as a script for others at some point. as it sits now, unless there is an issue with the code syntax, it wont show up in the log and it wont notify you if it succedes or fails. Wish you the best on this, and now I go back to the linux kernel code I have been working on for my nintendo switch. lol. I might have forgot a few semicolons at the end of some of the variable definitions. Easy enough to fix, but it wont let me change the code box now that it has been posted. Which is something I will look into later.