File builtin/vn/system.lua

system.lua Contains functions related to the operating system and external environment

Functions

canExit () Returns true if the engine runs in an environment where it can close itself.
exit (force) Asks (or forces) the engine to exit.
getPlayTime () Returns a string representation of the total playtime
onExit () The onExit function is called when the user presses the window close button or exit option from the window menu.
registerJavaClass (className, env) Create a Lua wrapper for the specified Java class (the class file must be available from the current classpath).
restart () Completely restarts the visual novel from the title screen.
setExitFunction (func, cleanup) Sets a custom function to be called when the user tries to exit the program or when the exit function is called.
website (url) Opens the website specified by url in an external web browser.


Functions

canExit ()
Returns true if the engine runs in an environment where it can close itself. When running embedded in a webpage for example, exiting doesn't make much sense.
exit (force)
Asks (or forces) the engine to exit. The behavior of this function is undefined if canExit returns false.

Parameters:

  • force: If true, forces an exit. Otherwise, the user will be presented with a confirmation popup.
getPlayTime ()
Returns a string representation of the total playtime
onExit ()
The onExit function is called when the user presses the window close button or exit option from the window menu.
registerJavaClass (className, env)
Create a Lua wrapper for the specified Java class (the class file must be available from the current classpath). The registered class should be Serializable or Externalizable and tagged with the nl.weeaboo.lua2.io.LuaSerializable annotation.

Parameters:

  • className: Fully-qualified Java class name
  • env: Lua table to register the functions in (default=_G).
restart ()
Completely restarts the visual novel from the title screen.
setExitFunction (func, cleanup)
Sets a custom function to be called when the user tries to exit the program or when the exit function is called. This starts a new mode "exit" in which the supplied exit function is called.

Parameters:

  • func: The function to call when the "exit" submode is entered. Return false to cancel the exit process.
  • cleanup: An optional function which is called when leaving the "exit" mode. (The "exit" mode may end even before func returns.)
website (url)
Opens the website specified by url in an external web browser.

Parameters:

  • url: The URL of the website

Valid XHTML 1.0!