Archived

This topic is now archived and is closed to further replies.

Chocoboko

Redefining _ALERT in Lua

Recommended Posts

Hi, I am using Lua in a Win32 environment, thus I don''t have access to an STDERR console. I have no way of seeing error messages from Lua. The documentation says that if I redefine _ALERT, I can change the way I see error messages. How can I do this? Thank you.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I am guessing you are using Lua 4 then, since in Lua 5 the error handling works differently. _ALERT is just a global variable. The standard library assigns a function to it that takes one string argument and prints this argument to STDERR. All you need to do is write your own _ALERT function after loading the standard libraries, and the standard _ALERT function will be overwritten by yours.

Share this post


Link to post
Share on other sites