## Fixture destroy check

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
elkiwydev
Prole
Posts: 8
Joined: Tue Jul 01, 2014 5:56 pm

### Fixture destroy check

Hi everyone,
I have a little problem.. I'm stuck in the error "Attempt to use a destroyed fixture" and I can't find a solution..
How do I check if a fixture is destroyed or not? I tried with "a==nil" (a is the fixture) but is not nil,is just destroyed..
Also every method I try to apply to the fixture like a:getBody() return the error..
I want to do an if statement like

Code: Select all

if *the fixture is destroyed* then
--do nothing
else
--do the work with the fixture
end


OmarShehata
Party member
Posts: 259
Joined: Tue May 29, 2012 6:46 pm
Location: Egypt
Contact:

### Re: Fixture destroy check

This is generally a code design flaw.

Why is it that your code is trying to use a destroyed fixture anyway? If you're keeping them in an array, make sure you remove the destroyed ones, or mark them as destroyed in a table until they get removed.

Alternatively, you can try running a test through pcall, to catch the error, but you should really redesign your code to avoid this situation in the first place.

If you can give more info on how things are set up we can try to come up with more specific solutions

### Who is online

Users browsing this forum: No registered users and 7 guests