[Plugin Update] LuaScript v0.8
-
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.
- Added the luawinfile module which supports file-system interactions with full UTF-8 support. This can be accessed in LuaScript by using
-
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
-
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?)
-
@Jonathan-H Currently there is an issue with the certificate of the dev list, see also https://github.com/bruderstein/nppPluginManager/issues/132
-
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
-
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 commandswinfile.loadfile
is a UTF-8 implementation of the Lua built-in function load for loading (i.e. parsing and compiling) Lua codewinfile.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