If you want help with your code, SHOW YOUR CODE! Also, some resources.

If you want help writing, changing, fixing, debugging, or doing anything else with code, please post the entire, actual code you are working with -- not just snippets you think are relevant, and especially not untested "examples" or pseudo-code.

Also, please tell us what you've already tried, and what happened when you tried it. Otherwise, people will waste their time suggesting things you've already tried, and you'll waste your time reading those suggestions and explaining that you already tried them.

How to attach your code to your posts

Option #1: Attach your files to your post. When writing your post, scroll down to the "Advanced Options" section and press the "Manage Attachments" button. A small window will pop up where you can upload files from your computer to attach to your post. You should at least include the specific file you're working with, but attaching all of the addon's files (Lua, XML, and TOC) may be helpful for more complex problems.

Option #2: Link to pastebin dumps of your code. Copy the full contents of each file into a separate "paste" on a pastebin site such as gist.github.com, paste2.org or pastebin.com. These are basically like Imgur or Photobucket, but for code instead of pictures. Include the link(s) to your pastes in your post.

Before asking for help ...

... make sure you search the forums. Your question may have already been asked and answered.

... check one or more of the resources (API documentation, tutorials, examples, tools, etc.) listed in the Useful Information / Tools / Links for Developers thread on these forums. Often, the answer you're looking for will be clearly explained on a documentation page (for example, if you're having trouble figuring out how to use a function, look for the documentation page about that function), and you won't have to wait for someone to give you the same information.