Community
    • Login

    [Plugin Update] LuaScript v0.8

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    6 Posts 4 Posters 2.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dailD
      dail
      last edited by

      A long overdue update to LuaScript v0.8 has been released and can be downloaded here

      LuaScript is a plugin for Lua scripting capabilities. This provides control over all of Scintilla’s features and options with a light-weight, fully-functional programming language. For an overview, see the readme.

      Changelog includes:

      • Added the luawinfile module which supports file-system interactions with full UTF-8 support. This can be accessed in LuaScript by using winfile. Documentation is currently lacking but they are still usable. Parts of this library are similar to luafilesystem which can be used as a reference.
        • winfile.dir
        • winfile.currentdir
        • winfile.chdir
        • winfile.touch
        • winfile.mkdir
        • winfile.rmdir
        • winfile.attributes
        • winfile.remove
        • winfile.rename
        • winfile.execute
        • winfile.getenv
        • winfile.loadfile
        • winfile.dofile
        • winfile.open
        • winfile.popen
        • winfile.shortname
        • winfile.personaldir
      • Overhauled the auto-completion to dynamically handle tables and their associated meta-tables.

      As always questions, comments, and feedback are welcome.

      1 Reply Last reply Reply Quote 6
      • chcgC
        chcg
        last edited by

        Update PluginManager to v0.8, see https://github.com/bruderstein/npp-plugins-x64/commit/1e53bec6bf72ff0832278cb83aceb95d95d1bdcb and also in https://npppm.bruderste.in/plugins/view/luascript

        1 Reply Last reply Reply Quote 2
        • Jonathan HJ
          Jonathan H
          last edited by

          Just a quick question, but how to I update the plugin manager itself? It’s stopped download the list when “use development plugin list is ticked” and come up with an error about being unable to download the list (which I assume is related to this update?)

          1 Reply Last reply Reply Quote 0
          • chcgC
            chcg
            last edited by chcg

            @Jonathan-H Currently there is an issue with the certificate of the dev list, see also https://github.com/bruderstein/nppPluginManager/issues/132

            1 Reply Last reply Reply Quote 0
            • guy038G
              guy038
              last edited by

              Hi, @dail, and All,

              Many thanks for your new V0.8 version of your Lua plugin !

              I just tried, briefly, to test the functions of the Luawinfile module. Up to now, I understood all the functions, listed below, with a short example of each of them !

              winfile.getenv ("path")                                => C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
              	
              winfile.currentdir ()                                  => D:\@@\758
              
              winfile.personaldir ()                                 => D:\
              
              winfile.chdir ("D:\\@@\\758\\plugins")                 => MOVE to the "D:\@@\758\plugins" folder, which becomes the CURRENT dir
              
              winfile.mkdir ("Test Folder")                          => CREATE the directory "Test Folder", under CURRENT directory
              
              winfile.rmdir ("Test Folder")                          => DELETE the directory "Test Folder", under CURRENT directory
              
              winfile.shortname ("First Test.txt")                   => Return the "8.3" representation of "First Test.txt" file ( FIRSTT~1.TXT )
              
              winfile.dofile ("First Test.txt")                      => EXECUTE "LUA code" contents of "First Test.txt" file
              
              winfile.rename ("First Test.txt" , "Second Test.txt")  => RENAME "First Test.txt" file as "Second Test.txt"
              
              winfile.touch ("Second Test.txt")                      => UPDATE modification / access time of "Second Test.txt" file to CURRENT time
              
              winfile.remove ("Second Test.txt")                     => DELETE "Second Test.txt" file
              

              But, as I haven’t begun to study, seriously, lua [scripting] language, as well as Python language and the NppExec plugin ( Yes, It’s a pity :-< ), I couldn’t find out, at first sight, the right behavior of all the other functions, below :

              winfile.attributes ( Though, it should be obvious ! )
              
              winfile.dir        ( It should allow to SCAN any file of a folder ? )
              
              winfile.execute
              
              winfile.loadfile
              
              winfile.open
              
              winfile.popen
              

              So, Dail, if you don’t mind, could you give me/us a brief description of these functions ? Thanks, in advance ;-)

              Best Regards,

              guy038

              dailD 1 Reply Last reply Reply Quote 1
              • dailD
                dail @guy038
                last edited by

                @guy038

                Some of them as you have found are fairly simple to understand. To clarify the rest of them you listed:

                • winfile.attributes is a UTF-8 implementation of the LuaFileSystem library’s attributes function. It is able to query various file attributes. I recommend looking at the link to see the full details.
                • winfile.dir is a UTF-8 implementation of the LuaFileSystem library’s dir function. And as you guess is used for iterating directories. An example can be seen here for recursively walking a directory.
                • winfile.execute is a UTF-8 implementation of the Lua built-in function os.execute for executing shell commands
                • winfile.loadfile is a UTF-8 implementation of the Lua built-in function load for loading (i.e. parsing and compiling) Lua code
                • winfile.open is a UTF-8 implementation of the Lua built-in function io.open for reading and writing to files.
                • winfile.popen is a UTF-8 implementation of the Lua built-in function io.popen to start an external process and return a file descriptor for reading/writing
                1 Reply Last reply Reply Quote 4
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors