Halt and catch fire: Difference between revisions

Content added Content deleted
(→‎{{header|Lua}}: added Lua solution)
m (→‎{{header|Lua}}: added another)
Line 226: Line 226:


=={{header|Lua}}==
=={{header|Lua}}==
Tricks could be used to shorten this, particularly in the interactive REPL, where <code>-_</code> would be enough (i.e., attempt to perform arithmetic on a nil global). This instead focuses on the "be useful elsewhere" aspect of the task, because it's short-enough as-is:
Tricks could be used to shorten this, particularly in the interactive REPL, where <code>-_</code> would be enough (i.e., attempt to perform arithmetic on a nil global). This instead focuses on the "be useful elsewhere" aspect of the task, because both seem short-enough as-is:
<lang lua>error(1)</lang>
<lang lua>error(1)</lang>
{{out}}
{{out}}
Line 232: Line 232:
stack traceback:
stack traceback:
[C]: in function 'error'
[C]: in function 'error'
stdin:1: in main chunk
[C]: in ?</pre>
Or:
<lang lua>assert(false)</lang>
{{out}}
<pre>stdin:1: assertion failed!
stack traceback:
[C]: in function 'assert'
stdin:1: in main chunk
stdin:1: in main chunk
[C]: in ?</pre>
[C]: in ?</pre>