Throw error when node ID is already taken

This commit is contained in:
Robert Machmer 2015-12-21 13:01:18 +01:00
parent e4d34d4281
commit 54a7a295ec

View File

@ -27,6 +27,7 @@ function Graph.new()
end end
function self:addNode( node ) function self:addNode( node )
assert( not nodes[node:getID()], "Node IDs must be unique." );
nodes[node:getID()] = node; nodes[node:getID()] = node;
end end