Skip to content
Josh Goebel edited this page Oct 7, 2021 · 21 revisions

exit

exit

This function causes program execution to be interrupted after the current "tic" completes, meaning after the TIC function finishes execution. The entire TIC function is still executed - including code that follows exit(). If you wish to return early you'd need to also use return.

See the example below for a demo of this behavior.

Once execution is interrupted you are returned to the console.

Example

Example

-- title:  exit API Command Demo (Lua)
-- author: StinkerB06

function TIC()
  cls(0)
  print("Press Z to exit to console.",1,1)
  if btn(4) then
    exit()
    trace("This code still runs!")
  end
end
Clone this wiki locally