collisionFilters.viewAllFilters()

Type Function
Return value Table
Revision Release 2024.3703
Keywords physics, collision, filter, viewAllFilters
See also collisionFilters.setupFilters()
collisionFilters.getFilter()

Overview

This function returns a table of all filters created via collisionFilters.setupFilters() in human-readable format, where each key is a category/filter name and the value of each key is another table containing a list of all categories masked against the key category.

Note

Data contained in the returned table is not valid for usage in the physics.addBody() function — its purpose is primarily for examining all filter relationships.

Syntax

collisionFilters.viewAllFilters()

Example

local collisionFilters = require( "plugin.collisionFilters" )

collisionFilters.setupFilters(
{
    player = { "enemies", "powerUps" },
    enemies = "playerBullets",
})

-- Find out which filters were created
local allReadableFilters = collisionFilters.viewAllFilters()
for k,v in pairs( allReadableFilters ) do
    print( "Filter/category '" .. k .. "' is set to collide with: " .. table.concat( v, ", " ) )
end