Shader:hasVariable

Edit

Returns whether the Shader has a variable.

exists = Shader:hasVariable(name)

Arguments

NameTypeDescription
namestring The name of the variable to check.

Returns

NameTypeDescription
existsboolean Whether the Shader has the variable.

Notes

This will return true if the variable is a buffer, texture, sampler, or other uniform variable (anything that can be sent with Pass:send).

Example

for key, texture in pairs(textures) do
  if shader:hasVariable(key) then
    pass:send(key, texture)
  end
end

See also