As some of you may remember, In my environment I am spawning several threads to run different lua scripts on. These scripts are run using luaL_loadbuffer and lua_pcall using my own error handler function which uses lua_getstack to output as much information as I can get. This works fairly well although some times there is no stack information (i.e. lua_getstack returns something other than 1), where I would expect there to be some. I do get some rather strange error messages though, my favourite being "attempt to call a string value" when there is a syntax error (such as missing 'then' after an 'if'). I want to create an environment that is easy to use and as easy to debug as possible, as the idea is that end users will be writing small scripts to control aspects of my environment. To further help the debugging purpose I am outputting the current line, as given in the lua_Debug struct. This however, rarely points to a meaningful line in the script, so what exactly does it relate to? Is it the compiled line, or source line? If the former, then what is the best way of recovering the source line where the error occured? I have also tried using the Line hook to keep track of line numbers, but unsurprisingly it gives the same information. Any pointers on this matter, would be greatly appreciated.