So I opened lua in my windows cmd. It is in interacive mode by default. I assigned some variables, created some functions. Now I want to flush it and start over. Do I need to quit with ctrl+Z and open it again or there is a command for it?
Asked
Active
Viewed 66 times
0
-
Also is there a way to print a body of my program in interactive mode? Meaning everything that been added so far. Variables, functions, tables, etc. – Shadow Realm Oct 07 '22 at 05:47
-
Yes, Ctrl-Z (or `os.exit()`) and start lua.exe again is the right way. – Egor Skriptunoff Oct 07 '22 at 15:31
-
You can run lua as `lua.exe -e"_PROMPT='; '_PROMPT2=' '" -i` to change the `>` symbols to `;`, so that you can just copy the whole text from the terminal window as a correct Lua program. – Egor Skriptunoff Oct 07 '22 at 15:36
1 Answers
0
You need to quit and open it again. The Lua standalone interpreter does not contain any feature that would allow you to reset its state. You can look through the standalone interpreter's source code at https://www.lua.org/source/5.4/lua.c.html to verify this.

Joseph Sible-Reinstate Monica
- 45,431
- 5
- 48
- 98