Menu

#2176 Corrections to LuaExtension.cxx

Bug
closed-fixed
nobody
5
2020-09-11
2020-05-19
No

A patch for SciTE version 4.3.3 is suggested. It fixes Lua 5.1 compatibility and Lua stack balance in 2 places.

1 Attachments

Discussion

  • Neil Hodgson

    Neil Hodgson - 2020-05-19
    • labels: --> scite, lua
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2020-05-19

    Committed as [7cd4be].

     

    Related

    Commit: [7cd4be]

  • Neil Hodgson

    Neil Hodgson - 2020-06-02
    • status: open-fixed --> closed-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2020-06-02

    Committed as [7cd4be].

     

    Related

    Commit: [7cd4be]

  • Neil Hodgson

    Neil Hodgson - 2020-06-26
    • status: closed-fixed --> open
     
  • Neil Hodgson

    Neil Hodgson - 2020-06-26

    This patch causes problems when saving the Lua startup script and its reloading. There will often be error messages like:

    > Lua: error checking global scope for command 'ShowEOLAnnotations'
    

    Changes to the script are ignored.

    Hunks 2 and 3 of the patch (pushing "buffer", and lua_pop(2)) must be restored to avoid the error and make reloading work.

     
  • Shmuel Zeigerman

    I would be happy to investigate the issue given it is reproducible.
    Could you provide me with .properties and Lua startup files so that I could see the problem myself?

    P.S. Last week I spent many hours working on "my version" of extman.lua (which is my startup script) and I have a dozen of Lua commands in the Tools menu. During that week I was saving the startup script very frequently yet never saw the '> Lua: error checking global scope for command' message. And yes, I'm using SciTE with those patches being discussed.

     

    Last edit: Shmuel Zeigerman 2020-06-26
  • Neil Hodgson

    Neil Hodgson - 2020-06-26

    Here are my user config files, although they are quite messy and hardly a minimal reproducible case. I didn't notice the problem until I was using a Lua script to prototype some new drawing features. The "error checking global scope for command" happens on both Windows and macOS.

     
  • Shmuel Zeigerman

    Thank you for the files!

    As SciTE v4.4.3 (June 03) does not have EOLAnnotations feature, I've built the latest Scintilla and SciTE commits (June 17). The menu item "ShowEOLAnnotations" works for me now. But unfortunately I'm still unable to reproduce the problem.

    I insert various print calls into the startup script, save it, see it automatically printing what I inserted ... but no error message, ever. I wonder if there exists a a step-by-step sequence to reproduce the error...

     
    • Neil Hodgson

      Neil Hodgson - 2020-06-27

      Options | Open Lua Startup Script
      Add "Bug" function:

      function Bug()
      print("earth")
      end
      

      Options | Open User Options File
      Add "Bug" to the tool menu:

      command.name.30.*=Bug
      command.30.*=Bug
      command.mode.30.*=subsystem:lua,savebefore:no,quiet:yes
      

      Exit SciTE
      Start SciTE
      View | Output
      Tools | Bug
      Output:

      earth
      

      Options | Open Lua Startup Script
      Edit "Bug" function, changing "earth" to "venus"

      print("venus")
      

      File | Save
      Tools | Bug
      Output:

      > Lua: error checking global scope for command 'Bug'
      
       
  • Shmuel Zeigerman

    Thanks for the instructions, they helped greatly.
    The patch is attached.

     
    • Neil Hodgson

      Neil Hodgson - 2020-06-27

      Committed as [c4b1e3].

       

      Related

      Commit: [c4b1e3]

  • Neil Hodgson

    Neil Hodgson - 2020-06-27
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2020-07-22
    • status: open-fixed --> closed-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2020-07-22
     

    Related

    Commit: [c4b1e3]

  • Neil Hodgson

    Neil Hodgson - 2020-07-28
    • status: closed-fixed --> open
     
  • Neil Hodgson

    Neil Hodgson - 2020-07-28

    This change causes problems when a parsing failure occurs. No functions will be found in the script after the parsing failure even if the script is fixed and reloaded. This differs from older versions such as 4.3.2.
    With this Lua startup script and properties set up like the earlier example:

    function Bug()
    print('bug')
    --~ x:y=1
    end
    

    Initially the script works correctly. Uncomment the commented line to produce x:y=1. Save will show an error:

    C:\Users\Neil/SciTEStartup.lua:3: function arguments expected near '='
    >Lua: error occurred while loading startup script
    

    Running Bug will also show an error:

    > Lua: error checking global scope for command 'Bug'
    

    Undo to restore the comment to produce --~ x:y=1. Save. Run Bug:

    > Lua: error checking global scope for command 'Bug'
    

    There appears to be no way to return Lua to working.

     
  • Shmuel Zeigerman

    Thanks for the detailed description.
    The patch is attached.

     
  • Neil Hodgson

    Neil Hodgson - 2020-07-28
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2020-07-28

    Committed fix as [60f2e0].

     

    Related

    Commit: [60f2e0]

  • Neil Hodgson

    Neil Hodgson - 2020-09-11
    • status: open-fixed --> closed-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2020-09-11

    Committed fix as [60f2e0].

     

    Related

    Commit: [60f2e0]


Log in to post a comment.