Fix for Entity:has not returning false if the component doesn't exist

The documentation states that Entity:has will return false if the component doesn't exist and true if it does.
However, the previous behaviour was to return nil if the component doesn't exist.
This commit is contained in:
Josh Perry 2018-03-13 14:30:25 +00:00
parent a50e3caf8b
commit 54af717df8

View file

@ -71,7 +71,7 @@ end
-- @params component The Component to check against
-- @return True if the entity has the Bag. False otherwise
function Entity:has(component)
return self.components[component] and true
return self.components[component] ~= nil
end
return setmetatable(Entity, {