—improved read() function with two modes for TAB completion:

–1: reads keys from a given environment
–2: reads file system paths
—use:
–read(_sReplaceChar, _tHistory,_tEnv,_mode)
–_tEnv is the environment to scan; default is _G
–_mode is by default true, what means mode 2 is chosen by default
–rightShift pressed once resets the matches; pressed twice changes the mode.
–tab-completing a full match adds a termination when possible, e.g. try calling test() (down below)
–and pressing: [tab][rigthShift][tab]

I took inspiration from this, by Espen .
Also, a great deal of the code was adapted from luasched .
shell integration can be done by replacing the read function globally and introducing the proper extra args for read in programs/shell and programs/lua. I'm writing my own shell so I won't bother with injection in CC.

Code:
github