Nocare3/love2dapi_chunks huggingface dataset:
CompressedImageData:getDimensions
Gets the width and height of the CompressedImageData.
width, height = CompressedImageData:getDimensions()
width number The width of the CompressedImageData.
height number The height of the CompressedImageData.
width, height = CompressedImageData:getDimensions( level )
level number A mipmap level. Must be in the range of CompressedImageData:getMipmapCount().
width number The width of a specific mipmap level of the CompressedImageData.
height number The height of a specific mipmap level of the CompressedImageData.
CompressedImageData:getFormat
Gets the format of the CompressedImageData.
format = CompressedImageData:getFormat()
format CompressedImageFormat The format of the CompressedImageData.
CompressedImageData:getHeight
Gets the height of the CompressedImageData.
height = CompressedImageData:getHeight()
height number The height of the CompressedImageData.
height = CompressedImageData:getHeight( level )
level number A mipmap level. Must be in the range of CompressedImageData:getMipmapCount().
height number The height of a specific mipmap level of the CompressedImageData.
CompressedImageData:getMipmapCount
Gets the number of mipmap levels in the CompressedImageData. The base mipmap level (original image) is included in the count.
mipmaps = CompressedImageData:getMipmapCount()
mipmaps number The number of mipmap levels stored in the CompressedImageData.
CompressedImageData:getWidth
Gets the width of the CompressedImageData.
width = CompressedImageData:getWidth()
width number The width of the CompressedImageData.
width = CompressedImageData:getWidth( level )
level number A mipmap level. Must be in the range of CompressedImageData:getMipmapCount().
width number The width of a specific mipmap level of the CompressedImageData.
ImageData:encode
Encodes the ImageData and optionally writes it to the save directory.
filedata = ImageData:encode( format, filename )
format ImageFormat The format to encode the image as.
filename (nil) string The filename to write the file to. If nil, no file will be written but the FileData will still be returned.
filedata FileData The encoded image as a new FileData object.
ImageData:encode( outFile )
outFile string Name of a file to write encoded data to. The format will be automatically deduced from the file extension.
ImageData:encode( outFile, format )
outFile string Name of a file to write encoded data to.
format ImageFormat The format to encode the image in.
ImageData:getDimensions
Gets the width and height of the ImageData in pixels.
width, height = ImageData:getDimensions()
width number The width of the ImageData in pixels.
height number The height of the ImageData in pixels.
ImageData:getHeight
Gets the height of the ImageData in pixels.
height = ImageData:getHeight()
height number The height of the ImageData in pixels.
ImageData:getPixel
Gets the color of a pixel at a specific position in the image.

Valid x and y values start at 0 and go up to image width and height minus 1. Non-integer values are floored.

In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
r, g, b, a = ImageData:getPixel( x, y )
x number The position of the pixel on the x-axis.
y number The position of the pixel on the y-axis.
r number The red component (0-1).
g number The green component (0-1).
b number The blue component (0-1).
a number The alpha component (0-1).
ImageData:getWidth
Gets the width of the ImageData in pixels.
width = ImageData:getWidth()
width number The width of the ImageData in pixels.
ImageData:mapPixel
Transform an image by applying a function to every pixel.

This function is a higher-order function. It takes another function as a parameter, and calls it once for each pixel in the ImageData.

The passed function is called with six parameters for each pixel in turn. The parameters are numbers that represent the x and y coordinates of the pixel and its red, green, blue and alpha values. The function should return the new red, green, blue, and alpha values for that pixel.

function pixelFunction(x, y, r, g, b, a)

-- template for defining your own pixel mapping function

-- perform computations giving the new values for r, g, b and a

-- ...

return r, g, b, a

end

In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
ImageData:mapPixel( pixelFunction, x, y, width, height )
pixelFunction function Function to apply to every pixel.
x (0) number The x-axis of the top-left corner of the area within the ImageData to apply the function to.
y (0) number The y-axis of the top-left corner of the area within the ImageData to apply the function to.
width (ImageData:getWidth()) number The width of the area within the ImageData to apply the function to.
height (ImageData:getHeight()) number The height of the area within the ImageData to apply the function to.
ImageData:paste
Paste into ImageData from another source ImageData.
ImageData:paste( source, dx, dy, sx, sy, sw, sh )
source ImageData Source ImageData from which to copy.
dx number Destination top-left position on x-axis.
dy number Destination top-left position on y-axis.
sx number Source top-left position on x-axis.
sy number Source top-left position on y-axis.
sw number Source width.
sh number Source height.
ImageData:setPixel
Sets the color of a pixel at a specific position in the image.

Valid x and y values start at 0 and go up to image width and height minus 1.

In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
ImageData:setPixel( x, y, r, g, b, a )
x number The position of the pixel on the x-axis.
y number The position of the pixel on the y-axis.
r number The red component (0-1).
g number The green component (0-1).
b number The blue component (0-1).
a number The alpha component (0-1).
ImageData:setPixel( x, y, color )
x number The position of the pixel on the x-axis.
y number The position of the pixel on the y-axis.
color table A numerical indexed table with the red, green, blue and alpha values as numbers.
ImageData:getFormat
Gets the pixel format of the ImageData.
format = ImageData:getFormat()
format PixelFormat The pixel format the ImageData was created with.
love.joystick.getGamepadMappingString
Gets the full gamepad mapping string of the Joysticks which have the given GUID, or nil if the GUID isn't recognized as a gamepad.

The mapping string contains binding information used to map the Joystick's buttons an axes to the standard gamepad layout, and can be used later with love.joystick.loadGamepadMappings.
mappingstring = love.joystick.getGamepadMappingString( guid )
guid string The GUID value to get the mapping string for.
mappingstring string A string containing the Joystick's gamepad mappings, or nil if the GUID is not recognized as a gamepad.
love.joystick.getJoystickCount
Gets the number of connected joysticks.
joystickcount = love.joystick.getJoystickCount()
joystickcount number The number of connected joysticks.
love.joystick.getJoysticks
Gets a list of connected Joysticks.
joysticks = love.joystick.getJoysticks()
joysticks table The list of currently connected Joysticks.
love.joystick.loadGamepadMappings
Loads a gamepad mappings string or file created with love.joystick.saveGamepadMappings.

It also recognizes any SDL gamecontroller mapping string, such as those created with Steam's Big Picture controller configure interface, or this nice database. If a new mapping is loaded for an already known controller GUID, the later version will overwrite the one currently loaded.
love.joystick.loadGamepadMappings( filename )
filename string The filename to load the mappings string from.
love.joystick.loadGamepadMappings( mappings )
mappings string The mappings string to load.
love.joystick.saveGamepadMappings
Saves the virtual gamepad mappings of all recognized as gamepads and have either been recently used or their gamepad bindings have been modified.

The mappings are stored as a string for use with love.joystick.loadGamepadMappings.
mappings = love.joystick.saveGamepadMappings( filename )
filename string The filename to save the mappings string to.
mappings string The mappings string that was written to the file.
mappings = love.joystick.saveGamepadMappings()
mappings string The mappings string.
love.joystick.setGamepadMapping
Binds a virtual gamepad input to a button, axis or hat for all Joysticks of a certain type. For example, if this function is used with a GUID returned by a Dualshock 3 controller in OS X, the binding will affect Joystick:getGamepadAxis and Joystick:isGamepadDown for ''all'' Dualshock 3 controllers used with the game when run in OS X.

LÖVE includes built-in gamepad bindings for many common controllers. This function lets you change the bindings or add new ones for types of Joysticks which aren't recognized as gamepads by default.

The virtual gamepad buttons and axes are designed around the Xbox 360 controller layout.
success = love.joystick.setGamepadMapping( guid, button, inputtype, inputindex, hatdir )
guid string The OS-dependent GUID for the type of Joystick the binding will affect.
button GamepadButton The virtual gamepad button to bind.
inputtype JoystickInputType The type of input to bind the virtual gamepad button to.
inputindex number The index of the axis, button, or hat to bind the virtual gamepad button to.
hatdir (nil) JoystickHat The direction of the hat, if the virtual gamepad button will be bound to a hat. nil otherwise.
success boolean Whether the virtual gamepad button was successfully bound.
success = love.joystick.setGamepadMapping( guid, axis, inputtype, inputindex, hatdir )
guid string The OS-dependent GUID for the type of Joystick the binding will affect.
axis GamepadAxis The virtual gamepad axis to bind.
inputtype JoystickInputType The type of input to bind the virtual gamepad axis to.
inputindex number The index of the axis, button, or hat to bind the virtual gamepad axis to.
hatdir (nil) JoystickHat The direction of the hat, if the virtual gamepad axis will be bound to a hat. nil otherwise.
success boolean Whether the virtual gamepad axis was successfully bound.
Joystick:getAxes
Gets the direction of each axis.
axisDir1, axisDir2, axisDirN = Joystick:getAxes()
axisDir1 number Direction of axis1.
axisDir2 number Direction of axis2.
axisDirN number Direction of axisN.
Joystick:getAxis
Gets the direction of an axis.
direction = Joystick:getAxis( axis )
axis number The index of the axis to be checked.
direction number Current value of the axis.
Joystick:getAxisCount
Gets the number of axes on the joystick.
axes = Joystick:getAxisCount()
axes number The number of axes available.
Joystick:getButtonCount
Gets the number of buttons on the joystick.
buttons = Joystick:getButtonCount()
buttons number The number of buttons available.
Joystick:getDeviceInfo
Gets the USB vendor ID, product ID, and product version numbers of joystick which consistent across operating systems.

Can be used to show different icons, etc. for different gamepads.
vendorID, productID, productVersion = Joystick:getDeviceInfo()
vendorID number The USB vendor ID of the joystick.
productID number The USB product ID of the joystick.
productVersion number The product version of the joystick.
Joystick:getGUID
Gets a stable GUID unique to the type of the physical joystick which does not change over time. For example, all Sony Dualshock 3 controllers in OS X have the same GUID. The value is platform-dependent.
guid = Joystick:getGUID()
guid string The Joystick type's OS-dependent unique identifier.
Joystick:getGamepadAxis
Gets the direction of a virtual gamepad axis. If the Joystick isn't recognized as a gamepad or isn't connected, this function will always return 0.
direction = Joystick:getGamepadAxis( axis )
axis GamepadAxis The virtual axis to be checked.
direction number Current value of the axis.
Joystick:getGamepadMapping
Gets the button, axis or hat that a virtual gamepad input is bound to.
inputtype, inputindex, hatdirection = Joystick:getGamepadMapping( axis )
axis GamepadAxis The virtual gamepad axis to get the binding for.
inputtype JoystickInputType The type of input the virtual gamepad axis is bound to.
inputindex number The index of the Joystick's button, axis or hat that the virtual gamepad axis is bound to.
hatdirection JoystickHat The direction of the hat, if the virtual gamepad axis is bound to a hat. nil otherwise.
inputtype, inputindex, hatdirection = Joystick:getGamepadMapping( button )
button GamepadButton The virtual gamepad button to get the binding for.
inputtype JoystickInputType The type of input the virtual gamepad button is bound to.
inputindex number The index of the Joystick's button, axis or hat that the virtual gamepad button is bound to.
hatdirection JoystickHat The direction of the hat, if the virtual gamepad button is bound to a hat. nil otherwise.
Joystick:getGamepadMappingString
Gets the full gamepad mapping string of this Joystick, or nil if it's not recognized as a gamepad.

The mapping string contains binding information used to map the Joystick's buttons an axes to the standard gamepad layout, and can be used later with love.joystick.loadGamepadMappings.
mappingstring = Joystick:getGamepadMappingString()
mappingstring string A string containing the Joystick's gamepad mappings, or nil if the Joystick is not recognized as a gamepad.
Joystick:getHat
Gets the direction of the Joystick's hat.
direction = Joystick:getHat( hat )
hat number The index of the hat to be checked.
direction JoystickHat The direction the hat is pushed.
Joystick:getHatCount
Gets the number of hats on the joystick.
hats = Joystick:getHatCount()
hats number How many hats the joystick has.
Joystick:getID
Gets the joystick's unique identifier. The identifier will remain the same for the life of the game, even when the Joystick is disconnected and reconnected, but it '''will''' change when the game is re-launched.
id, instanceid = Joystick:getID()
id number The Joystick's unique identifier. Remains the same as long as the game is running.
instanceid number Unique instance identifier. Changes every time the Joystick is reconnected. nil if the Joystick is not connected.
Joystick:getName
Gets the name of the joystick.
name = Joystick:getName()
name string The name of the joystick.
Joystick:getVibration
Gets the current vibration motor strengths on a Joystick with rumble support.
left, right = Joystick:getVibration()
left number Current strength of the left vibration motor on the Joystick.
right number Current strength of the right vibration motor on the Joystick.
Joystick:isConnected
Gets whether the Joystick is connected.
connected = Joystick:isConnected()
connected boolean True if the Joystick is currently connected, false otherwise.
Joystick:isDown
Checks if a button on the Joystick is pressed.

LÖVE 0.9.0 had a bug which required the button indices passed to Joystick:isDown to be 0-based instead of 1-based, for example button 1 would be 0 for this function. It was fixed in 0.9.1.
anyDown = Joystick:isDown( buttonN )
buttonN number The index of a button to check.
anyDown boolean True if any supplied button is down, false if not.
Joystick:isGamepad
Gets whether the Joystick is recognized as a gamepad. If this is the case, the Joystick's buttons and axes can be used in a standardized manner across different operating systems and joystick models via Joystick:getGamepadAxis, Joystick:isGamepadDown, love.gamepadpressed, and related functions.

LÖVE automatically recognizes most popular controllers with a similar layout to the Xbox 360 controller as gamepads, but you can add more with love.joystick.setGamepadMapping.
isgamepad = Joystick:isGamepad()
isgamepad boolean True if the Joystick is recognized as a gamepad, false otherwise.
Joystick:isGamepadDown
Checks if a virtual gamepad button on the Joystick is pressed. If the Joystick is not recognized as a Gamepad or isn't connected, then this function will always return false.
anyDown = Joystick:isGamepadDown( buttonN )
buttonN GamepadButton The gamepad button to check.
anyDown boolean True if any supplied button is down, false if not.
Joystick:isVibrationSupported
Gets whether the Joystick supports vibration.
supported = Joystick:isVibrationSupported()
supported boolean True if rumble / force feedback vibration is supported on this Joystick, false if not.
Joystick:setVibration
Sets the vibration motor speeds on a Joystick with rumble support. Most common gamepads have this functionality, although not all drivers give proper support. Use Joystick:isVibrationSupported to check.
success = Joystick:setVibration( left, right )
left number Strength of the left vibration motor on the Joystick. Must be in the range of 1.
right number Strength of the right vibration motor on the Joystick. Must be in the range of 1.
success boolean True if the vibration was successfully applied, false if not.
success = Joystick:setVibration()
success boolean True if the vibration was successfully disabled, false if not.
success = Joystick:setVibration( left, right, duration )
left number Strength of the left vibration motor on the Joystick. Must be in the range of 1.
right number Strength of the right vibration motor on the Joystick. Must be in the range of 1.
duration (-1) number The duration of the vibration in seconds. A negative value means infinite duration.
success boolean True if the vibration was successfully applied, false if not.
love.keyboard.getKeyFromScancode
Gets the key corresponding to the given hardware scancode.

Unlike key constants, Scancodes are keyboard layout-independent. For example the scancode 'w' will be generated if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.

Scancodes are useful for creating default controls that have the same physical locations on on all systems.
key = love.keyboard.getKeyFromScancode( scancode )
scancode Scancode The scancode to get the key from.
key KeyConstant The key corresponding to the given scancode, or 'unknown' if the scancode doesn't map to a KeyConstant on the current system.
love.keyboard.getScancodeFromKey
Gets the hardware scancode corresponding to the given key.

Unlike key constants, Scancodes are keyboard layout-independent. For example the scancode 'w' will be generated if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.

Scancodes are useful for creating default controls that have the same physical locations on on all systems.
scancode = love.keyboard.getScancodeFromKey( key )
key KeyConstant The key to get the scancode from.
scancode Scancode The scancode corresponding to the given key, or 'unknown' if the given key has no known physical representation on the current system.
love.keyboard.hasKeyRepeat
Gets whether key repeat is enabled.
enabled = love.keyboard.hasKeyRepeat()
enabled boolean Whether key repeat is enabled.
love.keyboard.hasScreenKeyboard
Gets whether screen keyboard is supported.
supported = love.keyboard.hasScreenKeyboard()
supported boolean Whether screen keyboard is supported.
love.keyboard.hasTextInput
Gets whether text input events are enabled.
enabled = love.keyboard.hasTextInput()
enabled boolean Whether text input events are enabled.
love.keyboard.isDown
Checks whether a certain key is down. Not to be confused with love.keypressed or love.keyreleased.
down = love.keyboard.isDown( key )
key KeyConstant The key to check.
down boolean True if the key is down, false if not.
anyDown = love.keyboard.isDown( key, ... )
key KeyConstant A key to check.
... KeyConstant Additional keys to check.
anyDown boolean True if any supplied key is down, false if not.
love.keyboard.isScancodeDown
Checks whether the specified Scancodes are pressed. Not to be confused with love.keypressed or love.keyreleased.

Unlike regular KeyConstants, Scancodes are keyboard layout-independent. The scancode 'w' is used if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.
down = love.keyboard.isScancodeDown( scancode, ... )
scancode Scancode A Scancode to check.
... Scancode Additional Scancodes to check.
down boolean True if any supplied Scancode is down, false if not.
love.keyboard.setKeyRepeat
Enables or disables key repeat for love.keypressed. It is disabled by default.
love.keyboard.setKeyRepeat( enable )
enable boolean Whether repeat keypress events should be enabled when a key is held down.
love.keyboard.setTextInput
Enables or disables text input events. It is enabled by default on Windows, Mac, and Linux, and disabled by default on iOS and Android.

On touch devices, this shows the system's native on-screen keyboard when it's enabled.
love.keyboard.setTextInput( enable )
enable boolean Whether text input events should be enabled.
love.keyboard.setTextInput( enable, x, y, w, h )
enable boolean Whether text input events should be enabled.
x number Text rectangle x position.
y number Text rectangle y position.
w number Text rectangle width.
h number Text rectangle height.
love.math.colorFromBytes
Converts a color from 0..255 to 0..1 range.
r, g, b, a = love.math.colorFromBytes( rb, gb, bb, ab )
rb number Red color component in 0..255 range.
gb number Green color component in 0..255 range.
bb number Blue color component in 0..255 range.
ab (nil) number Alpha color component in 0..255 range.
r number Red color component in 0..1 range.
g number Green color component in 0..1 range.
b number Blue color component in 0..1 range.
a number Alpha color component in 0..1 range or nil if alpha is not specified.
love.math.colorToBytes
Converts a color from 0..1 to 0..255 range.
rb, gb, bb, ab = love.math.colorToBytes( r, g, b, a )
r number Red color component.
g number Green color component.
b number Blue color component.
a (nil) number Alpha color component.
rb number Red color component in 0..255 range.
gb number Green color component in 0..255 range.
bb number Blue color component in 0..255 range.
ab number Alpha color component in 0..255 range or nil if alpha is not specified.
love.math.gammaToLinear
Converts a color from gamma-space (sRGB) to linear-space (RGB). This is useful when doing gamma-correct rendering and you need to do math in linear RGB in the few cases where LÖVE doesn't handle conversions automatically.

Read more about gamma-correct rendering here, here, and here.

In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
lr, lg, lb = love.math.gammaToLinear( r, g, b )
r number The red channel of the sRGB color to convert.
g number The green channel of the sRGB color to convert.
b number The blue channel of the sRGB color to convert.
lr number The red channel of the converted color in linear RGB space.
lg number The green channel of the converted color in linear RGB space.
lb number The blue channel of the converted color in linear RGB space.
lr, lg, lb = love.math.gammaToLinear( color )
color table An array with the red, green, and blue channels of the sRGB color to convert.
lr number The red channel of the converted color in linear RGB space.
lg number The green channel of the converted color in linear RGB space.
lb number The blue channel of the converted color in linear RGB space.
lc = love.math.gammaToLinear( c )
c number The value of a color channel in sRGB space to convert.
lc number The value of the color channel in linear RGB space.
love.math.getRandomSeed
Gets the seed of the random number generator.

The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed can be an integer value up to 2^64.
low, high = love.math.getRandomSeed()
low number Integer number representing the lower 32 bits of the random number generator's 64 bit seed value.
high number Integer number representing the higher 32 bits of the random number generator's 64 bit seed value.