Shader:hasAttribute

Edit

Returns whether the Shader has a vertex attribute, by name or location.



Arguments

NameTypeDescription
namestring The name of an attribute.

Returns

NameTypeDescription
existsboolean Whether the Shader has the attribute.

Arguments

NameTypeDescription
locationnumber The location of an attribute.

Returns

NameTypeDescription
existsboolean Whether the Shader has the attribute.

Example

function lovr.load()
  shader = lovr.graphics.newShader([[
    in uint coolAttribute;

    vec4 lovrmain() {
      return DefaultPosition;
    }
  ]], [[
    vec4 lovrmain() {
      return DefaultColor;
    }
  ]])

  print(shader:hasAttribute('coolAttribute')) --> true
end

See also