sys.halt([mode])

Shutdown the operating system.

Parameters

mode

An optional string that indicates the shutdown method to use. If this parameter is not specified, the default value "shutdown" is used.

  • "logoff" : close the current Windows session
  • "shutdown" : shutdown the computer
  • "reboot" : reboot the computer
  • "force" : do not wait for other applications to terminate

Return value

This function returns no value.

Example

local console = require "console" print('Do you want to close the current session ? (y/n)') local answer = string.upper(console.read(1)) if answer == 'Y' then sys.halt("logoff") end