Updates a uniform variable in the Shader.

success = Shader:send(uniform, value)


uniformstringThe name of the uniform to update.
value*The new value of the uniform.


successbooleanWhether the uniform exists and was updated.


The shader does not need to be active to update its uniforms.

The following type combinations are supported:

Uniform type LÖVR type
float number
int number
vec2 { x, y }
vec3 { x, y, z } or vec3
vec4 { x, y, z, w }
ivec2 { x, y }
ivec3 { x, y, z }
ivec4 { x, y, z, w }
mat2 { x, ... }
mat3 { x, ... }
mat4 { x, ... } or mat4
sampler Texture
image Texture

Uniform arrays can be wrapped in tables or passed as multiple arguments.

Textures must match the type of sampler or image they are being sent to.

The following sampler (and image) types are currently supported:

Blobs can be used to pass arbitrary binary data to Shader variables.


Updating a vec3 uniform:

function lovr.load()
  shader =[[
    uniform vec3 offset;
    vec4 position(mat4 projection, mat4 transform, vec4 vertex) { += offset;
      return projection * transform * vertex;
  ]], nil)

  shader:send('offset', { .3, .7, 0 })

See also