Re: [code] [textadept] Crashing when setting the color for line numbers

From: Chris Emerson <>
Date: Wed, 9 Sep 2015 09:19:04 +0100

Hi Attila,

(Resending with the right address, in case the previous one gets through)

On Wed, 9 Sep 2015 09:29:32 +0200, Attila Nemeth <> wrote:
> I am using the GUI version, and the crash was happening with the GUI
> version. I'm suspecting that the cause of the crash is me doing something
> foolish in lua since I'm very new to it, or the way I'm doing something is
> wrong.

I do two things for debugging Lua scripts:

1. Logging. In my init.lua, I have something like:

local log_file
function _G.my_log(msg)
    if log_file == nil then
        log_file ="ta_debug.txt", "w") -- use full path if needed

Then I can sprinkle my_log("Entered foo(), x="..tostring(x)) around.

2. Run any code you're suspicious of under (x)pcall, eg:

local res, msg = xpcall(function()
--[[ code you want to run here
end, function(msg)
    return debug.traceback(msg) -- Add traceback to any error raised
end) -- end of xpcall call
if not res then
    -- Log the error, eg into a file
    f ="ta_error.txt", "w")

I actually wrap my whole init.lua in the above.

If you're running in the Windows GUI version, you might want to use a full
path to log/error files, eg "c:\\temp\\ta_debug.txt" to be sure they go
somewhere useful.

Hope this helps,


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Wed 09 Sep 2015 - 04:19:04 EDT

This archive was generated by hypermail 2.2.0 : Wed 09 Sep 2015 - 06:44:20 EDT