Reputation: 3105
For example, if I'm writing a multiline command in Python, I can just press ctrl-c
.
In Lua, for one liners, I could press ctrl-u
to clear a single line, but that doesn't do anything for multi-line functions, etc. ctrl-c
in Lua quits the interpreter.
Edit: As an example say I'm writing a function in Lua:
>> function Test()
..> print 'Test'
..> e
At this point, I'm about to write end
and I realize I didn't want to call the function Test()
, rather I wanted to call it Test123()
, how would I break out of this like with Python's ctrl-c
?
Upvotes: 4
Views: 1354
Reputation: 72312
Even when Lua is reading multiline statements, it is reading it line by line by calling readline
. The effect is that you can only edit the current line, not the whole multiline.
The same thing seems to happen in Python (when multiline statements are signaled by a \
continuation). However, Python seems to handle ctrl-c
different from Lua: it somehow catches ctrl-c
and returns to the prompt, whereas Lua has not signal handler for ctrl-c
set during input and so aborts the program, which is the default action.
Upvotes: 1
Reputation: 26744
You can always type ';', which will terminate the current command. You will get a syntax error in this case (as the statement is not complete), but you can then use parts of your command for a new command.
Upvotes: 3