Module vn

Functions

call (filename) Starts executing the specified script
choice (...) Asks the user to select an option.
clearGlobals () Clears all globals previously stored using setGlobal.
flattenModule (env) Flattens this module and its submodules into env
getGlobal (name) Returns a value previously stored using setGlobal.
getMode () Returns the current mode
getProperty (obj, name) Calls the default getter function corresponging to a property called name.
getSharedGlobal (name) Returns the value of a previously stored shared global.
getSkipMode () Returns the current skip mode
getSkipUnread () Returns true if skipping should stop at unread text
incrGlobal (name, inc) Increases/decreases the value of the stored global by the specified amount.
newThread (func, ...) Creates a new Lua thread
setGlobal (name, value) Sets a value in the globals object.
setMode (m, onModeEnter, onModeExit) Changes the current mode
setProperties (obj, props) Calls the setProperty function for each key/value pair in props.
setProperty (obj, name, ...) Calls the default setter function corresponding to a property called name.
setSharedGlobal (name, value) Sets a shared global.
setSkipMode (s) Changes the current SkipMode to s
setSkipUnread (u) Toggles whether of not to skip past unread text lines
skipParagraph () Turns skip mode on for the remainder of the paragraph
skipScene () Turns skip mode on for the remainder of the scene (the end of the file, or when a choice appears)
wait (duration) Pauses the current thread for the specified time.
waitClick (unskippable) Pauses the main thread and yields


Functions

call (filename)
Starts executing the specified script

Parameters:

  • filename:
choice (...)
Asks the user to select an option.

Parameters:

  • ...: A vararg with all selectable options.

Return value:

    The index of the selected option (starting at 1).
clearGlobals ()
Clears all globals previously stored using setGlobal.
flattenModule (env)
Flattens this module and its submodules into env

Parameters:

  • env: The table (often _G) to flatten the module into.
getGlobal (name)
Returns a value previously stored using setGlobal.

Parameters:

  • name: The name of the global.

Return value:

    The stored value, or nil if none exists.
getMode ()
Returns the current mode

See also:

getProperty (obj, name)
Calls the default getter function corresponging to a property called name.

Parameters:

  • obj: The object to get the property value of.
  • name: The name of the property to get the value of.

Return value:

    The value of the property (result of calling the property getter function).
getSharedGlobal (name)
Returns the value of a previously stored shared global.

Parameters:

  • name: The name of the shared global.

Return value:

    The stored value, or nil if none exists.

See also:

getSkipMode ()
Returns the current skip mode
getSkipUnread ()
Returns true if skipping should stop at unread text
incrGlobal (name, inc)
Increases/decreases the value of the stored global by the specified amount.

Parameters:

  • name: The name of the global
  • inc: The value to add to the global, may be negative but must be a number.

Return value:

    The new value of the global
newThread (func, ...)
Creates a new Lua thread

Parameters:

  • func: The function to run in the new thread.
  • ...: The parameters to pass to the function.

Return value:

    A new thread object.
setGlobal (name, value)
Sets a value in the globals object. The main benefit of storing data inside the globals object instead of a regular Lua variable is to be able to recover their values in case of a broken save file.

Parameters:

  • name: The name of the global. Names starting with vn. are reserved for use by NVList.
  • value: The new value for the global.
setMode (m, onModeEnter, onModeExit)
Changes the current mode

Parameters:

  • m: The new mode
  • onModeEnter: An optional function argument that will be called when the new mode starts.
  • onModeExit: An optional function argument that will be called when the new mode ends.
setProperties (obj, props)
Calls the setProperty function for each key/value pair in props.

Parameters:

  • obj: The object to set the property value on.
  • props: The table of properties to set.
setProperty (obj, name, ...)
Calls the default setter function corresponding to a property called name.

Parameters:

  • obj: The object to set the property value on.
  • name: The name of the property to change.
  • ...: The parameters to pass to the setter function (the new value for the property).
setSharedGlobal (name, value)
Sets a shared global. All save slots have access to the same set of shared globals. Commonly used to mark routes as cleared or unlocked.

Parameters:

  • name: The name of the shared global. Names starting with vn. are reserved for use by NVList.
  • value: The new value for the shared global.
setSkipMode (s)
Changes the current SkipMode to s

Parameters:

  • s: The new SkipMode, or 0 to stop skipping.
setSkipUnread (u)
Toggles whether of not to skip past unread text lines

Parameters:

  • u:
skipParagraph ()
Turns skip mode on for the remainder of the paragraph
skipScene ()
Turns skip mode on for the remainder of the scene (the end of the file, or when a choice appears)
wait (duration)
Pauses the current thread for the specified time. The pause time is influenced by the effectSpeed.

Parameters:

  • duration: The time to wait in frames
waitClick (unskippable)
Pauses the main thread and yields

Parameters:

  • unskippable:

Valid XHTML 1.0!