• World of Warcraft Addons
  • World of Warcraft
  • Average Rating:

  • Your Rating

  • Share
  • Report Abuse

LibDebug

 
Project Updated:
Files Updated: Sun, May 24 2009
Supports Game Version: 3.1.0
Category: Libraries, and Development Tools
Tags:

[Edit Tags]

Project Manager: smariot
Additional Authors: No additional authors
Current Version: v0
License: GNU Lesser General Public License version 3 (LGPLv
Development Site: CurseForge
Avg Daily DL (last 30 days): 1
Downloads Total: 471
Favorites: 1
Comments: 0
  • About LibDebug
  •  

LibDebug is a tool to aid with debugging AddOns. It does the following:

  • Throws errors when using undefined variables.
  • Throws errors when setting global variables.
  • Replaces the print function. Colours values by their type, escapes unprintable characters in strings, and turns tables into clickable links.

It does NOT do the following:

  • Catch and display errors, use BugSack or Swatter for that.

To use it, call LibDebug() at the top of any lua file you want to use the above features in.

While LibDebug is embedable, you probably don't want to do that. You'll probably want to make it an optional dependency, then you can put

if LibDebug then LibDebug() end

at the top of a source file instead, and have it work properly whether or not the addon is available. If you want to go that route, then feel free to use LibDebug as a flag for enabling other debug features in your AddOn as well, which you can turn on or off simply by enabling or disabling LibDebug.

The purpose of catching the use of global variables is to detect misnamed variables and variables that were intended to be local, but not declared as such.

If LibDebug complains about something you actually intended, the correct thing to do is usually to access the variable directly through _G. For example,

my_global_variable = 42

function MyFunction()
  print(my_global_variable)
end

should be written as:

_G.my_global_variable = 42

function _G.MyFunction()
  print(my_global_variable)
end

Note that once you set a variable through _G, it become exempt from generating errors. This won't generate any errors:

_G.foo = nil
foo = "floor"
foo = foo.."caek"

You can generally use variables from the global environment without any errors, as long as they are not nil, or were set through _G. If you want to use a global variable created by another AddOn that might be nil, you need to use _G in this case as well.

  • Downloads (1)
  •  
File Name Release Type Game Version Downloads Date
Addon Curse.com Beta 2.3.3 0 9/29/2008
  File Name Release Type Game Version Downloads Date  
  LibDebug v0 Release 3.1.0 471 5/24/2009
  • 1 page(s)
  • Comments
This author has elected not to allow comments for this project.
  • Addon Packs Containing LibDebug

Most Downloads / Day

LibDebug has not been added to any Addon Packs yet.

  • Similar Addons
  •  

Average downloads per day

  1. 487 Ace3 Libraries
  2. 437 Addon Control Panel Libraries, Libraries, Development...
  3. 437 Addon Control Panel Libraries, Libraries, Development...
  4. 345 !BugGrabber Development Tools
  5. 268 Ace2 Libraries