PDA

View Full Version : finding errors in lua code?



Anonymous D
July 7th, 2007, 19:21
At the moment i use a command script to launch lua player and my script. the only way i can get errors though is to quickly switch back to the command prompt before the script crashes, and try and printscreen it. this is incrediably annoying.
is there some code , or setup that will log the erorrs to a text file for easy reading?

parkermauney
July 7th, 2007, 19:27
Make a batch file that loads your script with luaplayer, then on the next line type "pause".

splodger15
July 7th, 2007, 21:44
luaplayer changethis.lua
pause

change "changethis.lua" to your script you are running eg script.lua then save it as script.cmd or whatever

dangee
July 7th, 2007, 22:37
in luaplayer 2.0:

pcall (f, arg1, ...)
--------------------
Calls function f with the given arguments in protected
mode. This means that any error inside f is not
propagated; instead, pcall catches the error and returns
a status code. Its first result is the status code (a
boolean), which is true if the call succeeds without
errors. In such case, pcall also returns all results from
the call, after this first result. In case of any error,
pcall returns false plus the error message.

Anonymous D
July 8th, 2007, 13:18
thanks muchly for the quick replies