From 1ef665776dfdd9bd9774506bdcd94024498bc01c Mon Sep 17 00:00:00 2001 From: "martin.holst@gmail.com" Date: Fri, 24 May 2013 21:06:20 +0000 Subject: [PATCH] Added a PoC script which implements a commandline --- client/scripts/cmdline.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 client/scripts/cmdline.lua diff --git a/client/scripts/cmdline.lua b/client/scripts/cmdline.lua new file mode 100644 index 00000000..9c4df144 --- /dev/null +++ b/client/scripts/cmdline.lua @@ -0,0 +1,12 @@ +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"); -- 2.39.2