Can am commander cat delete

Can am commander cat delete a folder?

I'm creating a game and have been putting together most of the levels. I have a big map that has a mn level and five others. I've got everything to work and am now going to create a menu to load the levels.

I need to save the level data and all of the art, but I want to avoid having to save all that at once when loading the level. So I created a folder, "SaveFile".

I'm not sure if this is the best approach or if it will cause any problems. I put everything into the folder and closed the program. If I run it agn it will crash, but it will load correctly.

Is there any issue with doing this or will it be a problem when I load it in to the game?

Thank you for any help.


It should work. In fact, the fact that you're not getting any errors is a good sign that it's working correctly.

It's a good idea to keep the game data separate from your game's assets, but not mandatory. If you've built your game and don't want to worry about keeping your assets and game data separate, that's okay. You can just keep them together in one directory. However, if you ever decide to have two or more games at once, you'll want to keep them apart.


You are probably not loading the files from the save folder correctly.

From the comment to @thesamethingit

The thing is that I have the data from one game and I'll be using it to save a second game. The only thing I'll be loading into the game is the level data, everything else will be saved to a folder.

If you have the level data as seperate files, it should be fine.

As long as you know where those files are stored, the rest is all good.

However, if you are using the same folder to store the game data as the files to save the game, the game will crash as you won't be able to find any of your data, because they're stored in a different location than the files you want to load.


To clarify on this, think about it.

File1 is in the SaveFiles Folder

File2 is in the "SaveFiles" folder, but in a different path than File1

The problem with this is that the File2 location is hard-coded into the SaveFiles.lua code.

It doesn't understand the SaveFiles.lua, just assumes it is in the same location as the .jar files

To solve this, you could go to the directory you want to save it and put the game files into the "SaveFiles" folder. So, it would be something like:

SaveFiles Folder

----GameData Folder

----GameData (with the .jar files)

----SaveFiles (with the .lua files)

Now, assuming the location for the save files is something like:


And the .lua files are in:


Now when you call loadGameFiles() to load the game data from "SaveFiles", it'll load those files into the correct place, and have a much more reliable and easy-to-update game.


The mn reason why this is happening is because the SaveFiles.lua uses hard-coded path values for the path's of your game files.

For example, it looks like this:

path = "../../../GameData/SaveFiles"

So, if I'm looking at the SaveFiles.lua in the GameData folder, the relative path is:


Now let's say that I look at the SaveFiles.lua in the SaveFiles folder, the path would be:


And this is an example of how the paths differ, and it would be a problem in every .lua file in Titan. This is where you can't simply just put in a hard-coded path.

A Solution

One way around this problem is to use a custom function to create a path for you, instead of using hard-coded ones:

function CreatePathFromSaveFiles(Game)

GamePath = "../"..("/SaveFiles"):gsub("%c"):gsub("/", "")

return GamePath


This will work for every .lua file that Titan has, by making sure that they use the same format.

To put this into action, open up the .lua file that you would like to update. Inside that file, add a function call to the function that you just made, then call the function, like so:

function loadSaveFiles()

GamePath = CreatePathFromSaveFiles(self)

LoadFile(GamePath + "SaveFiles/SaveFiles.lua")


A final note

If you want to get more info about the Gsub function, you can take a look at this SO question.


Try this:

function LoadSaveFiles(Game)

GamePath = "../"..("/SaveFiles"):gsub("%c"):gsub("/", "")



To be clear: this will make it work no matter where you put the LoadSaveFiles() function in the rest of your code, but it's up to you to find where you need to call this function.


This is not the only solution to your problem.

There are more options like using a string.gsub(), a regexp.gsub() or a table.gsub()

You can read more about this on Lua Programming Guide

Watch the video: Maverick XRS cat removal and new exhaust slip ons installed

Previous Article

Why Do Cats Rub Against Things?

Next Article

Do Dogs Like to Be Tickled?