2019-05-07 22:48:18 +02:00
|
|
|
--[[
|
|
|
|
A sampe script file on how to implement at cmd line inteface.
|
|
|
|
--]]
|
|
|
|
|
2013-05-24 21:06:20 +00:00
|
|
|
print("This is how a cmd-line interface could be implemented\nPrint 'exit' to exit.\n")
|
|
|
|
local answer
|
|
|
|
repeat
|
2019-03-09 10:34:43 +01:00
|
|
|
io.write("$>")
|
|
|
|
io.flush()
|
2019-05-07 22:48:18 +02:00
|
|
|
answer = io.read()
|
2019-03-09 10:34:43 +01:00
|
|
|
if answer ~= 'exit' then
|
|
|
|
local func = assert(loadstring("return " .. answer))
|
|
|
|
io.write("\n"..tostring(func() or "").."\n");
|
|
|
|
end--]]
|
2019-05-07 22:48:18 +02:00
|
|
|
until answer == "exit"
|
2013-05-24 21:06:20 +00:00
|
|
|
print("Bye\n");
|