Thread Tools Display Modes
04-12-18, 02:29 AM   #1
doofus
A Chromatic Dragonspawn
Join Date: Feb 2018
Posts: 158
debugging crashing script

Hi guys

In many cases there is a (simple) error in the script and that causes some kind of exception and processing terminates right there. It is silent and I have no idea where the problem is, sometimes a typo other times a nil variable being used when it should not etc.

My way of "debugging" is to have an adequate number of "print" statements so I can tell where the code execution got interrupted and home into the problem line of code. But this is a very slow and cumbersome technique.

Is there a way, an API perhaps. to allow us to see what went wrong?
  Reply With Quote
04-12-18, 02:39 AM   #2
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
What are you on about? Literally every time a Lua error occurs, you get a popup from the error handler telling you the call stack trace, the line where it broke and which variables were involved.
__________________
  Reply With Quote
04-12-18, 05:07 AM   #3
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,364
Yeah, but if I'm not mistaken, you have to have Lua (or .lua?) errors enabled to have that happen.

He (she ?) probably doesn't have that enabled.
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?


Carbonite <----- GitHub main module (Maps ONLY) download link. The other modules are also available on GitHub.
Carbonite-CLASSIC<----- GitHub link to Carbonite Classic. Thanks to ircdirk for this!
  Reply With Quote
04-12-18, 07:09 AM   #4
Gethe
RealUI Developer
 
Gethe's Avatar
Premium Member
Featured
Join Date: Sep 2008
Posts: 942
Lua errors are disabled by default. While they can be turned on, I would recoomend getting !BugGrabber and BugSack. These will not only turn on Lua errors, but also present much more useful errors than Blizzards built-in tool.
__________________
Knowledge = Power; Be OP

  Reply With Quote
04-12-18, 10:57 AM   #5
doofus
A Chromatic Dragonspawn
Join Date: Feb 2018
Posts: 158
thank you.

for posterity, it is:

/console scriptErrors 1 to display LUA errors
/console scriptErrors 0 to hide LUA errors
  Reply With Quote
04-12-18, 11:24 AM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Is this toggle not in the default options window anymore?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
04-12-18, 11:57 AM   #7
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Not since July 18 2016, no.
  Reply With Quote
04-12-18, 12:26 PM   #8
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,364
By-the-way, doofus, it's Lua and not LUA. It's the Portuguese word for moon, and not an acronym or abbreviation.

I'm sorry, but that just drive's me up the wall.
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?


Carbonite <----- GitHub main module (Maps ONLY) download link. The other modules are also available on GitHub.
Carbonite-CLASSIC<----- GitHub link to Carbonite Classic. Thanks to ircdirk for this!

Last edited by jeffy162 : 04-12-18 at 05:14 PM. Reason: spelling correction!
  Reply With Quote
04-15-18, 11:33 PM   #9
doofus
A Chromatic Dragonspawn
Join Date: Feb 2018
Posts: 158
Originally Posted by jeffy162 View Post
By-the-way, doofus, it's Lua and not LUA. It's the Portuguese word for moon, and not an acronym or abbreviation.

I'm sorry, but that just drive's me up the wall.
I just copy'n'paste from the US battle.net forums :-)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » debugging crashing script


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off