diff options
author | elioat <hi@eli.li> | 2024-06-09 15:41:19 -0400 |
---|---|---|
committer | elioat <hi@eli.li> | 2024-06-09 15:41:19 -0400 |
commit | 79fcbb5f40e91fc74d4d7b1491b8e246ec6a42b5 (patch) | |
tree | 08499113a679e782f997dbaaf78a78a68bed6ca6 /lua/chupacabra/repl.lua | |
parent | a461b64cd0996f707914abc7927bb46da8026e46 (diff) | |
download | tour-79fcbb5f40e91fc74d4d7b1491b8e246ec6a42b5.tar.gz |
*
Diffstat (limited to 'lua/chupacabra/repl.lua')
-rw-r--r-- | lua/chupacabra/repl.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lua/chupacabra/repl.lua b/lua/chupacabra/repl.lua new file mode 100644 index 0000000..302f306 --- /dev/null +++ b/lua/chupacabra/repl.lua @@ -0,0 +1,21 @@ +local chupacabra = require("chupacabra") + +-- simple repl to interact with chupacabra + +while true do + io.write("chupacabra> ") + local input = io.read() + if input == "exit" then + break + end + local output = chupacabra.run(input, {}) + if type(output) == "table" then + local outputString = "" + for _, value in ipairs(output) do + outputString = outputString .. " " .. value -- FIXME: this is dog water + end + print("["..outputString.."]") + else + print(output) + end +end |