in this particular case, the answer was simply to test
Code: Select all
if not love.filesystem.isFile(pathOfPotentialImage) then --[[load generic instead and play warning sound effect]] end
-----------------------------------------------------
-----------------------------------------------------
[/b]
I'm not used to working with scripting languages, so this is really difficult for me to wrap my head around conceptually.
We have built a very simple tile-based level editor for our project that is itself a love2d program. We load in tiles by changing a few parameters in a config file, then pressing "L" to load the settings. very simple.
The big problem is that if we screw up one of the parameters in the config file, it crashes the editor!
For instance, if I enter in the config file the following slip up:
Code: Select all
image_filename='dessert_maps/sand_tile'
save the file, return to the editor and press "L' to load settings, the editor will crash, and I will lose what I've been working on.
I'd prefer if it simply did nothing, or loaded a default image, and then played an angry sound effect to let me know I need to try again.
Unfortunately, the typical "try, catch, finally" approach doesn't really pan out in lua. Or maybe it just plain doesn't work in a scripting language. I don't know.
Any thoughts on how I might correct this? (OTHER than making a better editor that doesn't relly on manually editing a config file. I know, I know, okay? But this represents a larger problem that would be nice to be get straightened out)