You've written a beautiful script, you hit F5 (you're a coder, buttons are for designers!), the game starts... your Runtime Report window starts flooding with errors. "Oh no! What will I do?!" you say aloud. Your faithful pet looks at you inquisitively. Why? Code makes you crazy.

So how can you mitigate the craziness? Learning basic troubleshooting!

Reading the problemEdit

Lua can make this difficult at times. The first thing you need to know about reading a problem is that files are (basically) read into the Lua interpreter from the top to the bottom. How can this help you troubleshoot? Always look at the top of the list of errors. The first error may be causing further errors and fixing it may fix others.

So how do you read an individual error? Consider the error below.


As you can see, this indicates and error on Line 8 of the script Booster. That's a good place to start looking.

Read the LineEdit

The first thing you have to do is actually read it. This can seem simple, but really look at it. You may know what you wrote but sometimes you just make a typing mistake. Only you can learn what common mistakes you make but some things can be:

  1. Captialization - Make sure your variables and function names have the proper capitalization!
  2. Spelling - Make sure the functions are spelled correctly. Make sure your variables are spelled the. same. way. every. time.
  3. Missing punctuation - Make sure you end all your "quotes" and (parentheses)

Which leads us right into...

Check the Scripting ReferenceEdit

Check the scripting reference, a lot. It was #2 on my most visited Chrome sites at one point for a good reason. You can't always remember everything 100% accurately and all the time. Make sure you are passing the right arguments, spelling the function name correctly and using the proper capitalization.

print(), Your Best FriendEdit

You looked at the line and nothing seems wrong. Maybe the problem isn't with the code, but with the values in the code. So how do we see this? As the title suggests, print is your best friend. Examples:

print(myVariable) -- Print the value of my variable.

print(myVariable, myOtherVariable) -- Print the value of myVariable and my otherVariable, separated by a ?.

print(self.modelRenderer) -- Print a member named modelRenderer.

Now make sure this value matches what you think it should be. For instance, you might find out that your value is nil when it should be 1, or a ModelRenderer table or something.

Finally, Seek HelpEdit

If all else fails, go ahead and look for actual human interaction. Hop on the forums and search to see if someone has a similar problem. If you can't find one, post your issue and people will help you! Try to be a thurough as possible about your issue. Definitely include any error messages you are getting and, if not the whole code, the line or lines surrounding the error.