Menu

#1139 Show correct error message during load of SciTEStartup.lua (e.g. syntax error)

Committed
closed
5
2016-03-16
2016-03-06
No

This is how SciTEStartup.lua is currently loaded and executed:

luaL_loadfile(luaState, startupScript.c_str());
if (!call_function(luaState, 0, true)) {
    host->Trace(">Lua: error occurred while loading startup script\n");
}

If an error occurs during the luaL_loadfile call (e.g. syntax error, OOM), the top of the stack contains a string (the error message) instead of the Lua code chunk. This causes the next line to attempt to call a string, resulting in this confusing error message:

attempt to call a string value
>Lua: error occurred while loading startup script

Discussion

  • Johannes Sasongko

    I'm not sure whether to use the Lua print function or to directly host->Trace the string; this patch uses the latter. Feel free to tweak it.

     
  • Neil Hodgson

    Neil Hodgson - 2016-03-07
    • labels: --> scite, lua
    • assigned_to: Neil Hodgson
    • Group: Completed --> Committed
     
  • Neil Hodgson

    Neil Hodgson - 2016-03-07

    Committed as [a9f6d5].

    Can't see any benefit from using print over Trace.

     

    Related

    Commit: [a9f6d5]

  • Neil Hodgson

    Neil Hodgson - 2016-03-16
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB