Aliases -- More verbose error messages

Posted by Katie Love on Mon 02 Mar 2009 03:36 AM — 3 posts, 16,855 views.

#0
Is there a way we can get the alias/trigger/etc name in error output. for example:

Immediate execution
[string "Alias: "]:39: bad argument #2 to 'SetVariable' (string expected, got nil)
stack traceback:
[C]: in function 'SetVariable'
[string "Alias: "]:39: in main chunk

This is a really easy problem to fix -- but I have no idea which alias the error is in. Is there a way to get that information?

Thanks!!! :-)
USA #1
Pretty sure it already does this as long as you give names to them. They don't require a name, so make sure you've given it a name.
Australia Forum Administrator #2
Quite right. Giving aliases and triggers a name makes the error message more helpful.

Also try turning on Game -> Trace. If you do that you see what alias matched, like this:


TRACE: Matched alias "blah"
Compile error
World: smaug 2
Immediate execution
[string "Alias: "]:1: unexpected symbol near '<eof>'


Now I can see that the alias that matched "blah" caused the error. Similarly with triggers.