luaexec.lua - Run Lua snippets inside Clink from the command line #230
chrisant996
started this conversation in
Scripts
Replies: 1 comment
-
The |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
To use this, copy it into your Clink scripts folder as
luaexec.lua
.When using Clink v1.2.46 or greater, the following key bindings are automatically defined:
Pressing Ctrl+X,Ctrl+L toggles "Lua Execute" mode in the command prompt. When a command line starts with "rem lua:" then the rest of the text will be executed as Lua code. This only works at the interactive input prompt; it cannot be used in batch files.
In Lua Execute mode, there is some simple completion support for Lua variables.
There is also a
dumpvar(value, depth)
function that dumps the value, recursing into tables to the specified depth (default is 1). It also color codes value types for easy reference. The colors are configurable.Examples:
rem lua: print(flexprompt.left_prompt)
prints the value offlexprompt.left_prompt
(e.g. if you have clink-flex-prompt installed).rem lua: flexprompt.left_prompt = "{cwd}"
sets the value of the variable.For more information, refer to the script source code.
luaexec.lua.txt
(Originally posted in #163, and now moved to Discussions.)
Beta Was this translation helpful? Give feedback.
All reactions