main function
stringlengths
8
40
chunks
stringlengths
41
8.32k
repo_name
stringclasses
1 value
Channel:push
Channel:push Send a message to the thread Channel. See Variant for the list of supported types. id = Channel:push( value ) value Variant The contents of the message. id number Identifier which can be supplied to Channel:hasRead
love2d-community.github.io/love-api
Channel:supply
Channel:supply Send a message to the thread Channel and wait for a thread to accept it. See Variant for the list of supported types. success = Channel:supply( value ) value Variant The contents of the message. success boolean Whether the message was successfully supplied (always true). success = Channel:supply( value, timeout ) value Variant The contents of the message. timeout number The maximum amount of time to wait. success boolean Whether the message was successfully supplied before the timeout expired.
love2d-community.github.io/love-api
Thread:getError
Thread:getError Retrieves the error string from the thread if it produced an error. err = Thread:getError() err string The error message, or nil if the Thread has not caused an error.
love2d-community.github.io/love-api
Thread:isRunning
Thread:isRunning Returns whether the thread is currently running. Threads which are not running can be (re)started with Thread:start. value = Thread:isRunning() value boolean True if the thread is running, false otherwise.
love2d-community.github.io/love-api
Thread:start
Thread:start Starts the thread. Beginning with version 0.9.0, threads can be restarted after they have completed their execution. Thread:start() Thread:start( ... ) ... Variant A string, number, boolean, LÖVE object, or simple table.
love2d-community.github.io/love-api
Thread:wait
Thread:wait Wait for a thread to finish. This call will block until the thread finishes. Thread:wait()
love2d-community.github.io/love-api
love.timer.getAverageDelta
love.timer.getAverageDelta Returns the average delta time (seconds per frame) over the last second. delta = love.timer.getAverageDelta() delta number The average delta time over the last second.
love2d-community.github.io/love-api
love.timer.getDelta
love.timer.getDelta Returns the time between the last two frames. dt = love.timer.getDelta() dt number The time passed (in seconds).
love2d-community.github.io/love-api
love.timer.getFPS
love.timer.getFPS Returns the current frames per second. fps = love.timer.getFPS() fps number The current FPS.
love2d-community.github.io/love-api
love.timer.getTime
love.timer.getTime Returns the value of a timer with an unspecified starting time. This function should only be used to calculate differences between points in time, as the starting time of the timer is unknown. time = love.timer.getTime() time number The time in seconds. Given as a decimal, accurate to the microsecond.
love2d-community.github.io/love-api
love.timer.sleep
love.timer.sleep Pauses the current thread for the specified amount of time. love.timer.sleep( s ) s number Seconds to sleep for.
love2d-community.github.io/love-api
love.timer.step
love.timer.step Measures the time between two frames. Calling this changes the return value of love.timer.getDelta. dt = love.timer.step() dt number The time passed (in seconds).
love2d-community.github.io/love-api
love.touch.getPosition
love.touch.getPosition Gets the current position of the specified touch-press, in pixels. x, y = love.touch.getPosition( id ) id light userdata The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values. x number The position along the x-axis of the touch-press inside the window, in pixels. y number The position along the y-axis of the touch-press inside the window, in pixels.
love2d-community.github.io/love-api
love.touch.getPressure
love.touch.getPressure Gets the current pressure of the specified touch-press. pressure = love.touch.getPressure( id ) id light userdata The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values. pressure number The pressure of the touch-press. Most touch screens aren't pressure sensitive, in which case the pressure will be 1.
love2d-community.github.io/love-api
love.touch.getTouches
love.touch.getTouches Gets a list of all active touch-presses. touches = love.touch.getTouches() touches table A list of active touch-press id values, which can be used with love.touch.getPosition.
love2d-community.github.io/love-api
love.video.newVideoStream
love.video.newVideoStream Creates a new VideoStream. Currently only Ogg Theora video files are supported. VideoStreams can't draw videos, see love.graphics.newVideo for that. videostream = love.video.newVideoStream( filename ) filename string The file path to the Ogg Theora video file. videostream VideoStream A new VideoStream. videostream = love.video.newVideoStream( file ) file File The File object containing the Ogg Theora video. videostream VideoStream A new VideoStream.
love2d-community.github.io/love-api
VideoStream:getFilename
VideoStream:getFilename Gets the filename of the VideoStream. filename = VideoStream:getFilename() filename string The filename of the VideoStream
love2d-community.github.io/love-api
VideoStream:isPlaying
VideoStream:isPlaying Gets whether the VideoStream is playing. playing = VideoStream:isPlaying() playing boolean Whether the VideoStream is playing.
love2d-community.github.io/love-api
VideoStream:pause
VideoStream:pause Pauses the VideoStream. VideoStream:pause()
love2d-community.github.io/love-api
VideoStream:play
VideoStream:play Plays the VideoStream. VideoStream:play()
love2d-community.github.io/love-api
VideoStream:rewind
VideoStream:rewind Rewinds the VideoStream. Synonym to VideoStream:seek(0). VideoStream:rewind()
love2d-community.github.io/love-api
VideoStream:seek
VideoStream:seek Sets the current playback position of the VideoStream. VideoStream:seek( offset ) offset number The time in seconds since the beginning of the VideoStream.
love2d-community.github.io/love-api
VideoStream:tell
VideoStream:tell Gets the current playback position of the VideoStream. seconds = VideoStream:tell() seconds number The number of seconds sionce the beginning of the VideoStream.
love2d-community.github.io/love-api
love.window.close
love.window.close Closes the window. It can be reopened with love.window.setMode. love.window.close()
love2d-community.github.io/love-api
love.window.fromPixels
love.window.fromPixels Converts a number from pixels to density-independent units. The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.fromPixels(1600) would return 800 in that case. This function converts coordinates from pixels to the size users are expecting them to display at onscreen. love.window.toPixels does the opposite. The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. Most LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units. value = love.window.fromPixels( pixelvalue ) pixelvalue number A number in pixels to convert to density-independent units. value number The converted number, in density-independent units. x, y = love.window.fromPixels( px, py ) px number The x-axis value of a coordinate in pixels. py number The y-axis value of a coordinate in pixels. x number The converted x-axis value of the coordinate, in density-independent units. y number The converted y-axis value of the coordinate, in density-independent units.
love2d-community.github.io/love-api
love.window.getDPIScale
love.window.getDPIScale Gets the DPI scale factor associated with the window. The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.getDPIScale() would return 2.0 in that case. The love.window.fromPixels and love.window.toPixels functions can also be used to convert between units. The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. scale = love.window.getDPIScale() scale number The pixel scale factor associated with the window.
love2d-community.github.io/love-api
love.window.getDesktopDimensions
love.window.getDesktopDimensions Gets the width and height of the desktop. width, height = love.window.getDesktopDimensions( displayindex ) displayindex (1) number The index of the display, if multiple monitors are available. width number The width of the desktop. height number The height of the desktop.
love2d-community.github.io/love-api
love.window.getDisplayCount
love.window.getDisplayCount Gets the number of connected monitors. count = love.window.getDisplayCount() count number The number of currently connected displays.
love2d-community.github.io/love-api
love.window.getDisplayName
love.window.getDisplayName Gets the name of a display. name = love.window.getDisplayName( displayindex ) displayindex (1) number The index of the display to get the name of. name string The name of the specified display.
love2d-community.github.io/love-api
love.window.getDisplayOrientation
love.window.getDisplayOrientation Gets current device display orientation. orientation = love.window.getDisplayOrientation( displayindex ) displayindex (nil) number Display index to get its display orientation, or nil for default display index. orientation DisplayOrientation Current device display orientation.
love2d-community.github.io/love-api
love.window.getFullscreen
love.window.getFullscreen Gets whether the window is fullscreen. fullscreen, fstype = love.window.getFullscreen() fullscreen boolean True if the window is fullscreen, false otherwise. fstype FullscreenType The type of fullscreen mode used.
love2d-community.github.io/love-api
love.window.getFullscreenModes
love.window.getFullscreenModes Gets a list of supported fullscreen modes. modes = love.window.getFullscreenModes( displayindex ) displayindex (1) number The index of the display, if multiple monitors are available. modes table A table of width/height pairs. (Note that this may not be in order.) modes.width number Window fullscreen width. modes.height number Window fullscreen height.
love2d-community.github.io/love-api
love.window.getIcon
love.window.getIcon Gets the window icon. imagedata = love.window.getIcon() imagedata ImageData The window icon imagedata, or nil if no icon has been set with love.window.setIcon.
love2d-community.github.io/love-api
love.window.getMode
love.window.getMode Gets the display mode and properties of the window. width, height, flags = love.window.getMode() width number Window width. height number Window height. flags table Table with the window properties: flags.fullscreen boolean Fullscreen (true), or windowed (false). flags.fullscreentype FullscreenType The type of fullscreen mode used. flags.vsync boolean True if the graphics framerate is synchronized with the monitor's refresh rate, false otherwise. flags.msaa number The number of antialiasing samples used (0 if MSAA is disabled). flags.resizable boolean True if the window is resizable in windowed mode, false otherwise. flags.borderless boolean True if the window is borderless in windowed mode, false otherwise. flags.centered boolean True if the window is centered in windowed mode, false otherwise. flags.display number The index of the display the window is currently in, if multiple monitors are available. flags.minwidth number The minimum width of the window, if it's resizable. flags.minheight number The minimum height of the window, if it's resizable. flags.highdpi boolean True if high-dpi mode is allowed on Retina displays in OS X. Does nothing on non-Retina displays. flags.refreshrate number The refresh rate of the screen's current display mode, in Hz. May be 0 if the value can't be determined. flags.x number The x-coordinate of the window's position in its current display. flags.y number The y-coordinate of the window's position in its current display. flags.srgb boolean Removed in 0.10.0 (use love.graphics.isGammaCorrect instead). True if sRGB gamma correction is applied when drawing to the screen.
love2d-community.github.io/love-api
love.window.getPosition
love.window.getPosition Gets the position of the window on the screen. The window position is in the coordinate space of the display it is currently in. x, y, displayindex = love.window.getPosition() x number The x-coordinate of the window's position. y number The y-coordinate of the window's position. displayindex number The index of the display that the window is in.
love2d-community.github.io/love-api
love.window.getSafeArea
love.window.getSafeArea Gets area inside the window which is known to be unobstructed by a system title bar, the iPhone X notch, etc. Useful for making sure UI elements can be seen by the user. x, y, w, h = love.window.getSafeArea() x number Starting position of safe area (x-axis). y number Starting position of safe area (y-axis). w number Width of safe area. h number Height of safe area.
love2d-community.github.io/love-api
love.window.getTitle
love.window.getTitle Gets the window title. title = love.window.getTitle() title string The current window title.
love2d-community.github.io/love-api
love.window.getVSync
love.window.getVSync Gets current vertical synchronization (vsync). vsync = love.window.getVSync() vsync number Current vsync status. 1 if enabled, 0 if disabled, and -1 for adaptive vsync.
love2d-community.github.io/love-api
love.window.hasFocus
love.window.hasFocus Checks if the game window has keyboard focus. focus = love.window.hasFocus() focus boolean True if the window has the focus or false if not.
love2d-community.github.io/love-api
love.window.hasMouseFocus
love.window.hasMouseFocus Checks if the game window has mouse focus. focus = love.window.hasMouseFocus() focus boolean True if the window has mouse focus or false if not.
love2d-community.github.io/love-api
love.window.isDisplaySleepEnabled
love.window.isDisplaySleepEnabled Gets whether the display is allowed to sleep while the program is running. Display sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed. enabled = love.window.isDisplaySleepEnabled() enabled boolean True if system display sleep is enabled / allowed, false otherwise.
love2d-community.github.io/love-api
love.window.isMaximized
love.window.isMaximized Gets whether the Window is currently maximized. The window can be maximized if it is not fullscreen and is resizable, and either the user has pressed the window's Maximize button or love.window.maximize has been called. maximized = love.window.isMaximized() maximized boolean True if the window is currently maximized in windowed mode, false otherwise.
love2d-community.github.io/love-api
love.window.isMinimized
love.window.isMinimized Gets whether the Window is currently minimized. minimized = love.window.isMinimized() minimized boolean True if the window is currently minimized, false otherwise.
love2d-community.github.io/love-api
love.window.isOpen
love.window.isOpen Checks if the window is open. open = love.window.isOpen() open boolean True if the window is open, false otherwise.
love2d-community.github.io/love-api
love.window.isVisible
love.window.isVisible Checks if the game window is visible. The window is considered visible if it's not minimized and the program isn't hidden. visible = love.window.isVisible() visible boolean True if the window is visible or false if not.
love2d-community.github.io/love-api
love.window.maximize
love.window.maximize Makes the window as large as possible. This function has no effect if the window isn't resizable, since it essentially programmatically presses the window's 'maximize' button. love.window.maximize()
love2d-community.github.io/love-api
love.window.minimize
love.window.minimize Minimizes the window to the system's task bar / dock. love.window.minimize()
love2d-community.github.io/love-api
love.window.requestAttention
love.window.requestAttention Causes the window to request the attention of the user if it is not in the foreground. In Windows the taskbar icon will flash, and in OS X the dock icon will bounce. love.window.requestAttention( continuous ) continuous (false) boolean Whether to continuously request attention until the window becomes active, or to do it only once.
love2d-community.github.io/love-api
love.window.restore
love.window.restore Restores the size and position of the window if it was minimized or maximized. love.window.restore()
love2d-community.github.io/love-api
love.window.setDisplaySleepEnabled
love.window.setDisplaySleepEnabled Sets whether the display is allowed to sleep while the program is running. Display sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed. love.window.setDisplaySleepEnabled( enable ) enable boolean True to enable system display sleep, false to disable it.
love2d-community.github.io/love-api
love.window.setFullscreen
love.window.setFullscreen Enters or exits fullscreen. The display to use when entering fullscreen is chosen based on which display the window is currently in, if multiple monitors are connected. success = love.window.setFullscreen( fullscreen ) fullscreen boolean Whether to enter or exit fullscreen mode. success boolean True if an attempt to enter fullscreen was successful, false otherwise. success = love.window.setFullscreen( fullscreen, fstype ) fullscreen boolean Whether to enter or exit fullscreen mode. fstype FullscreenType The type of fullscreen mode to use. success boolean True if an attempt to enter fullscreen was successful, false otherwise.
love2d-community.github.io/love-api
love.window.setIcon
love.window.setIcon Sets the window icon until the game is quit. Not all operating systems support very large icon images. success = love.window.setIcon( imagedata ) imagedata ImageData The window icon image. success boolean Whether the icon has been set successfully.
love2d-community.github.io/love-api
love.window.setMode
love.window.setMode Sets the display mode and properties of the window. If width or height is 0, setMode will use the width and height of the desktop. Changing the display mode may have side effects: for example, canvases will be cleared and values sent to shaders with canvases beforehand or re-draw to them afterward if you need to. success = love.window.setMode( width, height, flags ) width number Display width. height number Display height. flags table The flags table with the options: flags.fullscreen (false) boolean Fullscreen (true), or windowed (false). flags.fullscreentype ('desktop') FullscreenType The type of fullscreen to use. This defaults to 'normal' in 0.9.0 through 0.9.2 and to 'desktop' in 0.10.0 and older. flags.vsync (true) boolean True if LÖVE should wait for vsync, false otherwise. flags.msaa (0) number The number of antialiasing samples. flags.stencil (true) boolean Whether a stencil buffer should be allocated. If true, the stencil buffer will have 8 bits. flags.depth (0) number The number of bits in the depth buffer. flags.resizable (false) boolean True if the window should be resizable in windowed mode, false otherwise. flags.borderless (false) boolean True if the window should be borderless in windowed mode, false otherwise. flags.centered (true) boolean True if the window should be centered in windowed mode, false otherwise. flags.display (1) number The index of the display to show the window in, if multiple monitors are available. flags.minwidth (1) number The minimum width of the window, if it's resizable. Cannot be less than 1. flags.minheight (1) number The minimum height of the window, if it's resizable. Cannot be less than 1. flags.highdpi (false) boolean True if high-dpi mode should be used on Retina displays in macOS and iOS. Does nothing on non-Retina displays. flags.x (nil) number The x-coordinate of the window's position in the specified display. flags.y (nil) number The y-coordinate of the window's position in the specified display. flags.usedpiscale (true) boolean Disables automatic DPI scaling when false. flags.srgb (false) boolean Removed in 0.10.0 (set t.gammacorrect in conf.lua instead). True if sRGB gamma correction should be applied when drawing to the screen. success boolean True if successful, false otherwise.
love2d-community.github.io/love-api
love.window.setPosition
love.window.setPosition Sets the position of the window on the screen. The window position is in the coordinate space of the specified display. love.window.setPosition( x, y, displayindex ) x number The x-coordinate of the window's position. y number The y-coordinate of the window's position. displayindex (1) number The index of the display that the new window position is relative to.
love2d-community.github.io/love-api
love.window.setTitle
love.window.setTitle Sets the window title. love.window.setTitle( title ) title string The new window title.
love2d-community.github.io/love-api
love.window.setVSync
love.window.setVSync Sets vertical synchronization mode. love.window.setVSync( vsync ) vsync number VSync number: 1 to enable, 0 to disable, and -1 for adaptive vsync.
love2d-community.github.io/love-api
love.window.showMessageBox
love.window.showMessageBox Displays a message box dialog above the love window. The message box contains a title, optional text, and buttons. success = love.window.showMessageBox( title, message, type, attachtowindow ) title string The title of the message box. message string The text inside the message box. type ('info') MessageBoxType The type of the message box. attachtowindow (true) boolean Whether the message box should be attached to the love window or free-floating. success boolean Whether the message box was successfully displayed. pressedbutton = love.window.showMessageBox( title, message, buttonlist, type, attachtowindow ) title string The title of the message box. message string The text inside the message box. buttonlist table A table containing a list of button names to show. The table can also contain the fields enterbutton and escapebutton, which should be the index of the default button to use when the user presses 'enter' or 'escape', respectively. type ('info') MessageBoxType The type of the message box. attachtowindow (true) boolean Whether the message box should be attached to the love window or free-floating. pressedbutton number The index of the button pressed by the user. May be 0 if the message box dialog was closed without pressing a button.
love2d-community.github.io/love-api
love.window.toPixels
love.window.toPixels Converts a number from density-independent units to pixels. The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.toPixels(800) would return 1600 in that case. This is used to convert coordinates from the size users are expecting them to display at onscreen to pixels. love.window.fromPixels does the opposite. The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. Most LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units. pixelvalue = love.window.toPixels( value ) value number A number in density-independent units to convert to pixels. pixelvalue number The converted number, in pixels. px, py = love.window.toPixels( x, y ) x number The x-axis value of a coordinate in density-independent units to convert to pixels. y number The y-axis value of a coordinate in density-independent units to convert to pixels. px number The converted x-axis value of the coordinate, in pixels. py number The converted y-axis value of the coordinate, in pixels.
love2d-community.github.io/love-api
love.window.updateMode
love.window.updateMode Sets the display mode and properties of the window, without modifying unspecified properties. If width or height is 0, updateMode will use the width and height of the desktop. Changing the display mode may have side effects: for example, canvases will be cleared. Make sure to save the contents of canvases beforehand or re-draw to them afterward if you need to. success = love.window.updateMode( width, height, settings ) width number Window width. height number Window height. settings table The settings table with the following optional fields. Any field not filled in will use the current value that would be returned by love.window.getMode. settings.fullscreen boolean Fullscreen (true), or windowed (false). settings.fullscreentype FullscreenType The type of fullscreen to use. settings.vsync boolean True if LÖVE should wait for vsync, false otherwise. settings.msaa number The number of antialiasing samples. settings.resizable boolean True if the window should be resizable in windowed mode, false otherwise. settings.borderless boolean True if the window should be borderless in windowed mode, false otherwise. settings.centered boolean True if the window should be centered in windowed mode, false otherwise. settings.display number The index of the display to show the window in, if multiple monitors are available. settings.minwidth number The minimum width of the window, if it's resizable. Cannot be less than 1. settings.minheight number The minimum height of the window, if it's resizable. Cannot be less than 1. settings.highdpi boolean True if high-dpi mode should be used on Retina displays in macOS and iOS. Does nothing on non-Retina displays. settings.x number The x-coordinate of the window's position in the specified display. settings.y number The y-coordinate of the window's position in the specified display. success boolean True if successful, false otherwise.
love2d-community.github.io/love-api