Hi Hisham,

This is Rob Hoelz' linenoise binding.  Very useful for interactive Lua
scripts that need command-line editing, history and completion.

Really small and powerful, the self-contained linenoise.so is only 21Kb

I've included the linenoise library source, to make it completely
self-sufficient.

In lieu of actual documentation, here's an example:

local L = require 'linenoise'
-- L.clearscreen()
print '----- Testing lua-linenoise! ------'
local prompt, history = '? ', 'history.txt'
L.historyload(history) -- load existing history
L.setcompletion(function(c,s)
  if s == 'h' then
   L.addcompletion(c,'help')
   L.addcompletion(c,'halt')
 end
end)
local line = L.linenoise(prompt)
while line do
   if #line > 0 then
       print(line:upper())
       L.historyadd(line)
       L.historysave(history) -- save every new line
   end
   line = L.linenoise(prompt)
end

steve d.

Attachment: linenoise-0.2-1.rockspec
Description: Binary data

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Luarocks-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply via email to