Rename cmdline.lua to data_example_cmdline.lua
This commit is contained in:
committed by
Philippe Teuwen
parent
a62286b470
commit
cb5ed3ec64
19
client/luascripts/data_example_cmdline.lua
Executable file
19
client/luascripts/data_example_cmdline.lua
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env -S pm3 -l
|
||||
|
||||
--[[
|
||||
A sampe script file on how to implement at cmd line inteface.
|
||||
It also demonstrates how the script can be used with a shebang.
|
||||
--]]
|
||||
|
||||
print("This is how a cmd-line interface could be implemented\nPrint 'exit' to exit.\n")
|
||||
local answer
|
||||
repeat
|
||||
io.write("$>")
|
||||
io.flush()
|
||||
answer = io.read()
|
||||
if answer ~= 'exit' then
|
||||
local func = assert(loadstring("return " .. answer))
|
||||
io.write("\n"..tostring(func() or "").."\n");
|
||||
end--]]
|
||||
until answer == "exit"
|
||||
print("Bye\n");
|
||||
Reference in New Issue
Block a user