main function
stringlengths 8
40
| chunks
stringlengths 41
8.32k
| repo_name
stringclasses 1
value |
---|---|---|
RevoluteJoint:getJointSpeed | RevoluteJoint:getJointSpeed
Get the current joint angle speed.
s = RevoluteJoint:getJointSpeed()
s number Joint angle speed in radians/second. | love2d-community.github.io/love-api |
RevoluteJoint:getLimits | RevoluteJoint:getLimits
Gets the joint limits.
lower, upper = RevoluteJoint:getLimits()
lower number The lower limit, in radians.
upper number The upper limit, in radians. | love2d-community.github.io/love-api |
RevoluteJoint:getLowerLimit | RevoluteJoint:getLowerLimit
Gets the lower limit.
lower = RevoluteJoint:getLowerLimit()
lower number The lower limit, in radians. | love2d-community.github.io/love-api |
RevoluteJoint:getMaxMotorTorque | RevoluteJoint:getMaxMotorTorque
Gets the maximum motor force.
f = RevoluteJoint:getMaxMotorTorque()
f number The maximum motor force, in Nm. | love2d-community.github.io/love-api |
RevoluteJoint:getMotorSpeed | RevoluteJoint:getMotorSpeed
Gets the motor speed.
s = RevoluteJoint:getMotorSpeed()
s number The motor speed, radians per second. | love2d-community.github.io/love-api |
RevoluteJoint:getMotorTorque | RevoluteJoint:getMotorTorque
Get the current motor force.
f = RevoluteJoint:getMotorTorque()
f number The current motor force, in Nm. | love2d-community.github.io/love-api |
RevoluteJoint:getReferenceAngle | RevoluteJoint:getReferenceAngle
Gets the reference angle.
angle = RevoluteJoint:getReferenceAngle()
angle number The reference angle in radians. | love2d-community.github.io/love-api |
RevoluteJoint:getUpperLimit | RevoluteJoint:getUpperLimit
Gets the upper limit.
upper = RevoluteJoint:getUpperLimit()
upper number The upper limit, in radians. | love2d-community.github.io/love-api |
RevoluteJoint:hasLimitsEnabled | RevoluteJoint:hasLimitsEnabled
Checks whether limits are enabled.
enabled = RevoluteJoint:hasLimitsEnabled()
enabled boolean True if enabled, false otherwise. | love2d-community.github.io/love-api |
RevoluteJoint:isMotorEnabled | RevoluteJoint:isMotorEnabled
Checks whether the motor is enabled.
enabled = RevoluteJoint:isMotorEnabled()
enabled boolean True if enabled, false if disabled. | love2d-community.github.io/love-api |
RevoluteJoint:setLimits | RevoluteJoint:setLimits
Sets the limits.
RevoluteJoint:setLimits( lower, upper )
lower number The lower limit, in radians.
upper number The upper limit, in radians. | love2d-community.github.io/love-api |
RevoluteJoint:setLimitsEnabled | RevoluteJoint:setLimitsEnabled
Enables/disables the joint limit.
RevoluteJoint:setLimitsEnabled( enable )
enable boolean True to enable, false to disable. | love2d-community.github.io/love-api |
RevoluteJoint:setLowerLimit | RevoluteJoint:setLowerLimit
Sets the lower limit.
RevoluteJoint:setLowerLimit( lower )
lower number The lower limit, in radians. | love2d-community.github.io/love-api |
RevoluteJoint:setMaxMotorTorque | RevoluteJoint:setMaxMotorTorque
Set the maximum motor force.
RevoluteJoint:setMaxMotorTorque( f )
f number The maximum motor force, in Nm. | love2d-community.github.io/love-api |
RevoluteJoint:setMotorEnabled | RevoluteJoint:setMotorEnabled
Enables/disables the joint motor.
RevoluteJoint:setMotorEnabled( enable )
enable boolean True to enable, false to disable. | love2d-community.github.io/love-api |
RevoluteJoint:setMotorSpeed | RevoluteJoint:setMotorSpeed
Sets the motor speed.
RevoluteJoint:setMotorSpeed( s )
s number The motor speed, radians per second. | love2d-community.github.io/love-api |
RevoluteJoint:setUpperLimit | RevoluteJoint:setUpperLimit
Sets the upper limit.
RevoluteJoint:setUpperLimit( upper )
upper number The upper limit, in radians. | love2d-community.github.io/love-api |
RopeJoint:getMaxLength | RopeJoint:getMaxLength
Gets the maximum length of a RopeJoint.
maxLength = RopeJoint:getMaxLength()
maxLength number The maximum length of the RopeJoint. | love2d-community.github.io/love-api |
RopeJoint:setMaxLength | RopeJoint:setMaxLength
Sets the maximum length of a RopeJoint.
RopeJoint:setMaxLength( maxLength )
maxLength number The new maximum length of the RopeJoint. | love2d-community.github.io/love-api |
Shape:computeAABB | Shape:computeAABB
Returns the points of the bounding box for the transformed shape.
topLeftX, topLeftY, bottomRightX, bottomRightY = Shape:computeAABB( tx, ty, tr, childIndex )
tx number The translation of the shape on the x-axis.
ty number The translation of the shape on the y-axis.
tr number The shape rotation.
childIndex (1) number The index of the child to compute the bounding box of.
topLeftX number The x position of the top-left point.
topLeftY number The y position of the top-left point.
bottomRightX number The x position of the bottom-right point.
bottomRightY number The y position of the bottom-right point. | love2d-community.github.io/love-api |
Shape:computeMass | Shape:computeMass
Computes the mass properties for the shape with the specified density.
x, y, mass, inertia = Shape:computeMass( density )
density number The shape density.
x number The x postition of the center of mass.
y number The y postition of the center of mass.
mass number The mass of the shape.
inertia number The rotational inertia. | love2d-community.github.io/love-api |
Shape:getChildCount | Shape:getChildCount
Returns the number of children the shape has.
count = Shape:getChildCount()
count number The number of children. | love2d-community.github.io/love-api |
Shape:getRadius | Shape:getRadius
Gets the radius of the shape.
radius = Shape:getRadius()
radius number The radius of the shape. | love2d-community.github.io/love-api |
Shape:getType | Shape:getType
Gets a string representing the Shape.
This function can be useful for conditional debug drawing.
type = Shape:getType()
type ShapeType The type of the Shape. | love2d-community.github.io/love-api |
Shape:rayCast | Shape:rayCast
Casts a ray against the shape and returns the surface normal vector and the line position where the ray hit. If the ray missed the shape, nil will be returned. The Shape can be transformed to get it into the desired position.
The ray starts on the first point of the input line and goes towards the second point of the line. The fourth argument is the maximum distance the ray is going to travel as a scale factor of the input line length.
The childIndex parameter is used to specify which child of a parent shape, such as a ChainShape, will be ray casted. For ChainShapes, the index of 1 is the first edge on the chain. Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent, you must loop through all of its children.
The world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point.
hitx, hity = x1 + (x2 - x1) * fraction, y1 + (y2 - y1) * fraction
xn, yn, fraction = Shape:rayCast( x1, y1, x2, y2, maxFraction, tx, ty, tr, childIndex )
x1 number The x position of the input line starting point.
y1 number The y position of the input line starting point.
x2 number The x position of the input line end point.
y2 number The y position of the input line end point.
maxFraction number Ray length parameter.
tx number The translation of the shape on the x-axis.
ty number The translation of the shape on the y-axis.
tr number The shape rotation.
childIndex (1) number The index of the child the ray gets cast against.
xn number The x component of the normal vector of the edge where the ray hit the shape.
yn number The y component of the normal vector of the edge where the ray hit the shape.
fraction number The position on the input line where the intersection happened as a factor of the line length. | love2d-community.github.io/love-api |
Shape:testPoint | Shape:testPoint
This is particularly useful for mouse interaction with the shapes. By looping through all shapes and testing the mouse position with this function, we can find which shapes the mouse touches.
hit = Shape:testPoint( tx, ty, tr, x, y )
tx number Translates the shape along the x-axis.
ty number Translates the shape along the y-axis.
tr number Rotates the shape.
x number The x-component of the point.
y number The y-component of the point.
hit boolean True if inside, false if outside | love2d-community.github.io/love-api |
WeldJoint:getDampingRatio | WeldJoint:getDampingRatio
Returns the damping ratio of the joint.
ratio = WeldJoint:getDampingRatio()
ratio number The damping ratio. | love2d-community.github.io/love-api |
WeldJoint:getFrequency | WeldJoint:getFrequency
Returns the frequency.
freq = WeldJoint:getFrequency()
freq number The frequency in hertz. | love2d-community.github.io/love-api |
WeldJoint:getReferenceAngle | WeldJoint:getReferenceAngle
Gets the reference angle.
angle = WeldJoint:getReferenceAngle()
angle number The reference angle in radians. | love2d-community.github.io/love-api |
WeldJoint:setDampingRatio | WeldJoint:setDampingRatio
Sets a new damping ratio.
WeldJoint:setDampingRatio( ratio )
ratio number The new damping ratio. | love2d-community.github.io/love-api |
WeldJoint:setFrequency | WeldJoint:setFrequency
Sets a new frequency.
WeldJoint:setFrequency( freq )
freq number The new frequency in hertz. | love2d-community.github.io/love-api |
WheelJoint:getAxis | WheelJoint:getAxis
Gets the world-space axis vector of the Wheel Joint.
x, y = WheelJoint:getAxis()
x number The x-axis coordinate of the world-space axis vector.
y number The y-axis coordinate of the world-space axis vector. | love2d-community.github.io/love-api |
WheelJoint:getJointSpeed | WheelJoint:getJointSpeed
Returns the current joint translation speed.
speed = WheelJoint:getJointSpeed()
speed number The translation speed of the joint in meters per second. | love2d-community.github.io/love-api |
WheelJoint:getJointTranslation | WheelJoint:getJointTranslation
Returns the current joint translation.
position = WheelJoint:getJointTranslation()
position number The translation of the joint in meters. | love2d-community.github.io/love-api |
WheelJoint:getMaxMotorTorque | WheelJoint:getMaxMotorTorque
Returns the maximum motor torque.
maxTorque = WheelJoint:getMaxMotorTorque()
maxTorque number The maximum torque of the joint motor in newton meters. | love2d-community.github.io/love-api |
WheelJoint:getMotorSpeed | WheelJoint:getMotorSpeed
Returns the speed of the motor.
speed = WheelJoint:getMotorSpeed()
speed number The speed of the joint motor in radians per second. | love2d-community.github.io/love-api |
WheelJoint:getMotorTorque | WheelJoint:getMotorTorque
Returns the current torque on the motor.
torque = WheelJoint:getMotorTorque( invdt )
invdt number How long the force applies. Usually the inverse time step or 1/dt.
torque number The torque on the motor in newton meters. | love2d-community.github.io/love-api |
WheelJoint:getSpringDampingRatio | WheelJoint:getSpringDampingRatio
Returns the damping ratio.
ratio = WheelJoint:getSpringDampingRatio()
ratio number The damping ratio. | love2d-community.github.io/love-api |
WheelJoint:getSpringFrequency | WheelJoint:getSpringFrequency
Returns the spring frequency.
freq = WheelJoint:getSpringFrequency()
freq number The frequency in hertz. | love2d-community.github.io/love-api |
WheelJoint:isMotorEnabled | WheelJoint:isMotorEnabled
Checks if the joint motor is running.
on = WheelJoint:isMotorEnabled()
on boolean The status of the joint motor. | love2d-community.github.io/love-api |
WheelJoint:setMaxMotorTorque | WheelJoint:setMaxMotorTorque
Sets a new maximum motor torque.
WheelJoint:setMaxMotorTorque( maxTorque )
maxTorque number The new maximum torque for the joint motor in newton meters. | love2d-community.github.io/love-api |
WheelJoint:setMotorEnabled | WheelJoint:setMotorEnabled
Starts and stops the joint motor.
WheelJoint:setMotorEnabled( enable )
enable boolean True turns the motor on and false turns it off. | love2d-community.github.io/love-api |
WheelJoint:setMotorSpeed | WheelJoint:setMotorSpeed
Sets a new speed for the motor.
WheelJoint:setMotorSpeed( speed )
speed number The new speed for the joint motor in radians per second. | love2d-community.github.io/love-api |
WheelJoint:setSpringDampingRatio | WheelJoint:setSpringDampingRatio
Sets a new damping ratio.
WheelJoint:setSpringDampingRatio( ratio )
ratio number The new damping ratio. | love2d-community.github.io/love-api |
WheelJoint:setSpringFrequency | WheelJoint:setSpringFrequency
Sets a new spring frequency.
WheelJoint:setSpringFrequency( freq )
freq number The new frequency in hertz. | love2d-community.github.io/love-api |
World:destroy | World:destroy
Destroys the world, taking all bodies, joints, fixtures and their shapes with it.
An error will occur if you attempt to use any of the destroyed objects after calling this function.
World:destroy() | love2d-community.github.io/love-api |
World:getBodies | World:getBodies
Returns a table with all bodies.
bodies = World:getBodies()
bodies table A sequence with all bodies. | love2d-community.github.io/love-api |
World:getBodyCount | World:getBodyCount
Returns the number of bodies in the world.
n = World:getBodyCount()
n number The number of bodies in the world. | love2d-community.github.io/love-api |
World:getCallbacks | World:getCallbacks
Returns functions for the callbacks during the world update.
beginContact, endContact, preSolve, postSolve = World:getCallbacks()
beginContact function Gets called when two fixtures begin to overlap.
endContact function Gets called when two fixtures cease to overlap.
preSolve function Gets called before a collision gets resolved.
postSolve function Gets called after the collision has been resolved. | love2d-community.github.io/love-api |
World:getContactCount | World:getContactCount
Returns the number of contacts in the world.
n = World:getContactCount()
n number The number of contacts in the world. | love2d-community.github.io/love-api |
World:getContactFilter | World:getContactFilter
Returns the function for collision filtering.
contactFilter = World:getContactFilter()
contactFilter function The function that handles the contact filtering. | love2d-community.github.io/love-api |
World:getContacts | World:getContacts
Returns a table with all Contacts.
contacts = World:getContacts()
contacts table A sequence with all Contacts. | love2d-community.github.io/love-api |
World:getGravity | World:getGravity
Get the gravity of the world.
x, y = World:getGravity()
x number The x component of gravity.
y number The y component of gravity. | love2d-community.github.io/love-api |
World:getJointCount | World:getJointCount
Returns the number of joints in the world.
n = World:getJointCount()
n number The number of joints in the world. | love2d-community.github.io/love-api |
World:getJoints | World:getJoints
Returns a table with all joints.
joints = World:getJoints()
joints table A sequence with all joints. | love2d-community.github.io/love-api |
World:isDestroyed | World:isDestroyed
Gets whether the World is destroyed. Destroyed worlds cannot be used.
destroyed = World:isDestroyed()
destroyed boolean Whether the World is destroyed. | love2d-community.github.io/love-api |
World:isLocked | World:isLocked
Returns if the world is updating its state.
This will return true inside the callbacks from World:setCallbacks.
locked = World:isLocked()
locked boolean Will be true if the world is in the process of updating its state. | love2d-community.github.io/love-api |
World:isSleepingAllowed | World:isSleepingAllowed
Gets the sleep behaviour of the world.
allow = World:isSleepingAllowed()
allow boolean True if bodies in the world are allowed to sleep, or false if not. | love2d-community.github.io/love-api |
World:queryBoundingBox | World:queryBoundingBox
Calls a function for each fixture inside the specified area by searching for any overlapping bounding box (Fixture:getBoundingBox).
World:queryBoundingBox( topLeftX, topLeftY, bottomRightX, bottomRightY, callback )
topLeftX number The x position of the top-left point.
topLeftY number The y position of the top-left point.
bottomRightX number The x position of the bottom-right point.
bottomRightY number The y position of the bottom-right point.
callback function This function gets passed one argument, the fixture, and should return a boolean. The search will continue if it is true or stop if it is false. | love2d-community.github.io/love-api |
World:rayCast | World:rayCast
Casts a ray and calls a function for each fixtures it intersects.
World:rayCast( x1, y1, x2, y2, callback )
x1 number The x position of the starting point of the ray.
y1 number The x position of the starting point of the ray.
x2 number The x position of the end point of the ray.
y2 number The x value of the surface normal vector of the shape edge.
callback function A function called for each fixture intersected by the ray. The function gets six arguments and should return a number as a control value. The intersection points fed into the function will be in an arbitrary order. If you wish to find the closest point of intersection, you'll need to do that yourself within the function. The easiest way to do that is by using the fraction value. | love2d-community.github.io/love-api |
World:setCallbacks | World:setCallbacks
Sets functions for the collision callbacks during the world update.
Four Lua functions can be given as arguments. The value nil removes a function.
When called, each function will be passed three arguments. The first two arguments are the colliding fixtures and the third argument is the Contact between them. The postSolve callback additionally gets the normal and tangent impulse for each contact point. See notes.
If you are interested to know when exactly each callback is called, consult a Box2d manual
World:setCallbacks( beginContact, endContact, preSolve, postSolve )
beginContact function Gets called when two fixtures begin to overlap.
endContact function Gets called when two fixtures cease to overlap. This will also be called outside of a world update, when colliding objects are destroyed.
preSolve (nil) function Gets called before a collision gets resolved.
postSolve (nil) function Gets called after the collision has been resolved. | love2d-community.github.io/love-api |
World:setContactFilter | World:setContactFilter
Sets a function for collision filtering.
If the group and category filtering doesn't generate a collision decision, this function gets called with the two fixtures as arguments. The function should return a boolean value where true means the fixtures will collide and false means they will pass through each other.
World:setContactFilter( filter )
filter function The function handling the contact filtering. | love2d-community.github.io/love-api |
World:setGravity | World:setGravity
Set the gravity of the world.
World:setGravity( x, y )
x number The x component of gravity.
y number The y component of gravity. | love2d-community.github.io/love-api |
World:setSleepingAllowed | World:setSleepingAllowed
Sets the sleep behaviour of the world.
World:setSleepingAllowed( allow )
allow boolean True if bodies in the world are allowed to sleep, or false if not. | love2d-community.github.io/love-api |
World:translateOrigin | World:translateOrigin
Translates the World's origin. Useful in large worlds where floating point precision issues become noticeable at far distances from the origin.
World:translateOrigin( x, y )
x number The x component of the new origin with respect to the old origin.
y number The y component of the new origin with respect to the old origin. | love2d-community.github.io/love-api |
World:update | World:update
Update the state of the world.
World:update( dt, velocityiterations, positioniterations )
dt number The time (in seconds) to advance the physics simulation.
velocityiterations (8) number The maximum number of steps used to determine the new velocities when resolving a collision.
positioniterations (3) number The maximum number of steps used to determine the new positions when resolving a collision. | love2d-community.github.io/love-api |
love.sound.newDecoder | love.sound.newDecoder
Attempts to find a decoder for the encoded sound data in the specified file.
decoder = love.sound.newDecoder( file, buffer )
file File The file with encoded sound data.
buffer (2048) number The size of each decoded chunk, in bytes.
decoder Decoder A new Decoder object.
decoder = love.sound.newDecoder( filename, buffer )
filename string The filename of the file with encoded sound data.
buffer (2048) number The size of each decoded chunk, in bytes.
decoder Decoder A new Decoder object. | love2d-community.github.io/love-api |
love.sound.newSoundData | love.sound.newSoundData
Creates new SoundData from a filepath, File, or Decoder. It's also possible to create SoundData with a custom sample rate, channel and bit depth.
The sound data will be decoded to the memory in a raw format. It is recommended to create only short sounds like effects, as a 3 minute song uses 30 MB of memory this way.
soundData = love.sound.newSoundData( filename )
filename string The file name of the file to load.
soundData SoundData A new SoundData object.
soundData = love.sound.newSoundData( file )
file File A File pointing to an audio file.
soundData SoundData A new SoundData object.
soundData = love.sound.newSoundData( decoder )
decoder Decoder Decode data from this Decoder until EOF.
soundData SoundData A new SoundData object.
soundData = love.sound.newSoundData( samples, rate, bits, channels )
samples number Total number of samples.
rate (44100) number Number of samples per second
bits (16) number Bits per sample (8 or 16).
channels (2) number Either 1 for mono or 2 for stereo.
soundData SoundData A new SoundData object. | love2d-community.github.io/love-api |
Decoder:clone | Decoder:clone
Creates a new copy of current decoder.
The new decoder will start decoding from the beginning of the audio stream.
decoder = Decoder:clone()
decoder Decoder New copy of the decoder. | love2d-community.github.io/love-api |
Decoder:decode | Decoder:decode
Decodes the audio and returns a SoundData object containing the decoded audio data.
soundData = Decoder:decode()
soundData SoundData Decoded audio data. | love2d-community.github.io/love-api |
Decoder:getBitDepth | Decoder:getBitDepth
Returns the number of bits per sample.
bitDepth = Decoder:getBitDepth()
bitDepth number Either 8, or 16. | love2d-community.github.io/love-api |
Decoder:getChannelCount | Decoder:getChannelCount
Returns the number of channels in the stream.
channels = Decoder:getChannelCount()
channels number 1 for mono, 2 for stereo. | love2d-community.github.io/love-api |
Decoder:getDuration | Decoder:getDuration
Gets the duration of the sound file. It may not always be sample-accurate, and it may return -1 if the duration cannot be determined at all.
duration = Decoder:getDuration()
duration number The duration of the sound file in seconds, or -1 if it cannot be determined. | love2d-community.github.io/love-api |
Decoder:getSampleRate | Decoder:getSampleRate
Returns the sample rate of the Decoder.
rate = Decoder:getSampleRate()
rate number Number of samples per second. | love2d-community.github.io/love-api |
Decoder:seek | Decoder:seek
Sets the currently playing position of the Decoder.
Decoder:seek( offset )
offset number The position to seek to, in seconds. | love2d-community.github.io/love-api |
SoundData:getBitDepth | SoundData:getBitDepth
Returns the number of bits per sample.
bitdepth = SoundData:getBitDepth()
bitdepth number Either 8, or 16. | love2d-community.github.io/love-api |
SoundData:getChannelCount | SoundData:getChannelCount
Returns the number of channels in the SoundData.
channels = SoundData:getChannelCount()
channels number 1 for mono, 2 for stereo. | love2d-community.github.io/love-api |
SoundData:getDuration | SoundData:getDuration
Gets the duration of the sound data.
duration = SoundData:getDuration()
duration number The duration of the sound data in seconds. | love2d-community.github.io/love-api |
SoundData:getSample | SoundData:getSample
Gets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order.
sample = SoundData:getSample( i )
i number An integer value specifying the position of the sample (starting at 0).
sample number The normalized samplepoint (range -1.0 to 1.0).
sample = SoundData:getSample( i, channel )
i number An integer value specifying the position of the sample (starting at 0).
channel number The index of the channel to get within the given sample.
sample number The normalized samplepoint (range -1.0 to 1.0). | love2d-community.github.io/love-api |
SoundData:getSampleCount | SoundData:getSampleCount
Returns the number of samples per channel of the SoundData.
count = SoundData:getSampleCount()
count number Total number of samples. | love2d-community.github.io/love-api |
SoundData:getSampleRate | SoundData:getSampleRate
Returns the sample rate of the SoundData.
rate = SoundData:getSampleRate()
rate number Number of samples per second. | love2d-community.github.io/love-api |
SoundData:setSample | SoundData:setSample
Sets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order.
SoundData:setSample( i, sample )
i number An integer value specifying the position of the sample (starting at 0).
sample number The normalized samplepoint (range -1.0 to 1.0).
SoundData:setSample( i, channel, sample )
i number An integer value specifying the position of the sample (starting at 0).
channel number The index of the channel to set within the given sample.
sample number The normalized samplepoint (range -1.0 to 1.0). | love2d-community.github.io/love-api |
love.system.getClipboardText | love.system.getClipboardText
Gets text from the clipboard.
text = love.system.getClipboardText()
text string The text currently held in the system's clipboard. | love2d-community.github.io/love-api |
love.system.getOS | love.system.getOS
Gets the current operating system. In general, LÖVE abstracts away the need to know the current operating system, but there are a few cases where it can be useful (especially in combination with os.execute.)
osString = love.system.getOS()
osString string The current operating system. 'OS X', 'Windows', 'Linux', 'Android' or 'iOS'. | love2d-community.github.io/love-api |
love.system.getPowerInfo | love.system.getPowerInfo
Gets information about the system's power supply.
state, percent, seconds = love.system.getPowerInfo()
state PowerState The basic state of the power supply.
percent number Percentage of battery life left, between 0 and 100. nil if the value can't be determined or there's no battery.
seconds number Seconds of battery life left. nil if the value can't be determined or there's no battery. | love2d-community.github.io/love-api |
love.system.getProcessorCount | love.system.getProcessorCount
Gets the amount of logical processor in the system.
processorCount = love.system.getProcessorCount()
processorCount number Amount of logical processors. | love2d-community.github.io/love-api |
love.system.hasBackgroundMusic | love.system.hasBackgroundMusic
Gets whether another application on the system is playing music in the background.
Currently this is implemented on iOS and Android, and will always return false on other operating systems. The t.audio.mixwithsystem flag in love.conf can be used to configure whether background audio / music from other apps should play while LÖVE is open.
backgroundmusic = love.system.hasBackgroundMusic()
backgroundmusic boolean True if the user is playing music in the background via another app, false otherwise. | love2d-community.github.io/love-api |
love.system.openURL | love.system.openURL
Opens a URL with the user's web or file browser.
success = love.system.openURL( url )
url string The URL to open. Must be formatted as a proper URL.
success boolean Whether the URL was opened successfully. | love2d-community.github.io/love-api |
love.system.setClipboardText | love.system.setClipboardText
Puts text in the clipboard.
love.system.setClipboardText( text )
text string The new text to hold in the system's clipboard. | love2d-community.github.io/love-api |
love.system.vibrate | love.system.vibrate
Causes the device to vibrate, if possible. Currently this will only work on Android and iOS devices that have a built-in vibration motor.
love.system.vibrate( seconds )
seconds (0.5) number The duration to vibrate for. If called on an iOS device, it will always vibrate for 0.5 seconds due to limitations in the iOS system APIs. | love2d-community.github.io/love-api |
love.thread.getChannel | love.thread.getChannel
Creates or retrieves a named thread channel.
channel = love.thread.getChannel( name )
name string The name of the channel you want to create or retrieve.
channel Channel The Channel object associated with the name. | love2d-community.github.io/love-api |
love.thread.newChannel | love.thread.newChannel
Create a new unnamed thread channel.
One use for them is to pass new unnamed channels to other threads via Channel:push on a named channel.
channel = love.thread.newChannel()
channel Channel The new Channel object. | love2d-community.github.io/love-api |
love.thread.newThread | love.thread.newThread
Creates a new Thread from a filename, string or FileData object containing Lua code.
thread = love.thread.newThread( filename )
filename string The name of the Lua file to use as the source.
thread Thread A new Thread that has yet to be started.
thread = love.thread.newThread( fileData )
fileData FileData The FileData containing the Lua code to use as the source.
thread Thread A new Thread that has yet to be started.
thread = love.thread.newThread( codestring )
codestring string A string containing the Lua code to use as the source. It needs to either be at least 1024 characters long, or contain at least one newline.
thread Thread A new Thread that has yet to be started. | love2d-community.github.io/love-api |
Channel:clear | Channel:clear
Clears all the messages in the Channel queue.
Channel:clear() | love2d-community.github.io/love-api |
Channel:demand | Channel:demand
Retrieves the value of a Channel message and removes it from the message queue.
It waits until a message is in the queue then returns the message value.
value = Channel:demand()
value Variant The contents of the message.
value = Channel:demand( timeout )
timeout number The maximum amount of time to wait.
value Variant The contents of the message or nil if the timeout expired. | love2d-community.github.io/love-api |
Channel:getCount | Channel:getCount
Retrieves the number of messages in the thread Channel queue.
count = Channel:getCount()
count number The number of messages in the queue. | love2d-community.github.io/love-api |
Channel:hasRead | Channel:hasRead
Gets whether a pushed value has been popped or otherwise removed from the Channel.
hasread = Channel:hasRead( id )
id number An id value previously returned by Channel:push.
hasread boolean Whether the value represented by the id has been removed from the Channel via Channel:pop, Channel:demand, or Channel:clear. | love2d-community.github.io/love-api |
Channel:peek | Channel:peek
Retrieves the value of a Channel message, but leaves it in the queue.
It returns nil if there's no message in the queue.
value = Channel:peek()
value Variant The contents of the message. | love2d-community.github.io/love-api |
Channel:performAtomic | Channel:performAtomic
Executes the specified function atomically with respect to this Channel.
Calling multiple methods in a row on the same Channel is often useful. However if multiple Threads are calling this Channel's methods at the same time, the different calls on each Thread might end up interleaved (e.g. one or more of the second thread's calls may happen in between the first thread's calls.)
This method avoids that issue by making sure the Thread calling the method has exclusive access to the Channel until the specified function has returned.
ret1, ... = Channel:performAtomic( func, ... )
func function The function to call, the form of function(channel, arg1, arg2, ...) end. The Channel is passed as the first argument to the function when it is called.
... any Additional arguments that the given function will receive when it is called.
ret1 any The first return value of the given function (if any.)
... any Any other return values. | love2d-community.github.io/love-api |
Channel:pop | Channel:pop
Retrieves the value of a Channel message and removes it from the message queue.
It returns nil if there are no messages in the queue.
value = Channel:pop()
value Variant The contents of the message. | love2d-community.github.io/love-api |