I don’t suppose this is possible? I have lost one weeks’ worth of work as I have manged somehow to corrupt main.lua. Painful. But at least I can restore from a backup one week ago from my USB drive.
Any possibility of getting the Lua file back from the .app file?
Yes, it’s possible, but as you don’t yet know how, it’ll likely be much more work than just redoing the work. You already know what you wrote and how you wrote them, so you’ll have much less of a hassle rewriting the code than learning how to reverse engineer an app.
For the future, I recommend using version control software, like Git. There are plenty of good & free tutorials available online.
Thanks for posting XeduR. Good point on version control software. I’ve used it extensively over the years as an employee, but as a one man shop, I’ve neglected it for some time. I’ll have to get back to Git. Thanks again.
I have an old version of Glider IDE that crashed and totally burned my main.lua. Left me a file that contained NULL repeated thousands of times and completely wiped my code - ouch!
Not sure how git will help if the OP is not committing code changes?
Also, why have you lost a weeks worth of work in main.lua? You realise that is mainly for loading/initializing stuff and not where any actual logic should be?
Giving someone advice like, “I recommend using version control software, like Git…” has the implicit meaning that the person should back up their work frequently, i.e. use it for its intended purpose.
It’s like if a dentist recommends to their patient that they should brush their teeth twice a day in order to promote good oral hygiene and the patient says that the recommendation won’t help them because they would never brush their teeth. The dentist’s recommendation is 100% valid, regardless of whether or not the patient does it.
I got my project folders in OneDrive, so all changes are automatically saved and you also have a version history from where you can download any of the versions.
Services like OneDrive or Dropbox work if you are just working alone on your own projects, but they’ll lack the commit messages and easy means of identifying changes between different versions. There’s also no real “version control”, it’s just constant copying.
In any case, having backups is a must, but this is typically something that people only learn after first personally suffering severe loss of data.
My app grew out of legacy code that was all contained in one file.
Well, between not using version control software and a bloated main.lua file you wouldn’t think I have a PhD in Computer Science, experience working in AAA game studios and deep knowledge of software rendering. I’m well in my 40s now and have developed some bad habits working as a one man shop!
Anyways, no real harm done. I’ve managed to code again much of what I’ve lost and I’ll ‘Git’ going on Git and modularise my code. Time to ditch some bad habits!
@XeduR It’s not always implicit though. I know plenty of devs that will only commit on project milestones. Version control rather than source control you could say.
Their reasoning, not sure if it is right or not, is that they can always build the “last known good version” if live code needs a quick patch. This ensures no new bugs or partially completed stuff gets included.
I do not have enough git experience to advise “how to”.
Maybe going a bit off topic here, but I do have enough Git experience to say that this is definitely not how you’re supposed to use Git, or any other VCS for that part. It’s just sounds like a lazy excuse for not learning Git.
There’s really no reason at all to have lots of uncommitted work with Git. If you’re working on a larger feature or a new version, just create a separate branch and then merge it back to your main/master branch when done and tested. Another way is to use tags for your releases and then branch off from them into hotfix branches if necessary.
There are lots of different Git branching strategies to choose from. Just remember to not make it more complicated than necessary. Your chosen strategy should match your needs. GitHub Flow could be a good place to start: https://guides.github.com/introduction/flow/
My own basic advice when it comes to daily routine work is to always keep your commits as small as possible. You should be able to describe what you’ve done in the commit message without writing something like “a lot of changes to this and that…”. It’s very easy to go back in the commit history and revert specific commits if you need to, and this becomes A LOT harder if your commits are too big with each commit covering several different fixes and/or features.
Also, push often for backup reasons. You can push after every single commit if you are the only one working on your branch.
In my opinion there is no excuse for not using version control, even if you are a one-man team like myself. It just makes your life as a dev so much easier.
It’s a really tedious task to recover the code. Actually I am not sure how it looks now, but we once went through the process of hacking our app to see if we could get the code easily and it was close to impossible. even when we did get a glimpse at some part it was quite well protected.
If you use a good IDE it will have a local history which works like git, but without commits, checkout, for example, IntelliJ Idea (and other tools from JetBrains) have it and it saved my ass a lot of times.
The IDE I use is Lua Glider from M.Y. Developers. I think they expired some time ago. I will take the necessary steps to prevent being burned in this way again. I should’ve gone for prevention rather than cure. Give it another 10 years and I’ll maybe make the same mistake again! Give it another 10 years and I’ll be out of programming period! LOL!
You can encode them. There are texture sheet packers which offer this functionality. It does not have to be a texture. They can do single images as well.
@k.szczesny well that is interesting. I have .png and .jpg files that need encoding. I’ll take a look at it. Please feel free to recommend any tools that you use for this. Thank you.