Add varargs to the list of parameters a Node can receive

This commit is contained in:
Robert Machmer 2016-01-09 05:10:38 +01:00
parent af7f49a2ad
commit 8146caa558
2 changed files with 4 additions and 3 deletions

View File

@ -64,9 +64,10 @@ function Graph.new()
-- @param y - The y coordinate the Node should be spawned at (optional). -- @param y - The y coordinate the Node should be spawned at (optional).
-- @param anchor - Wether the node should be locked in place or not (optional). -- @param anchor - Wether the node should be locked in place or not (optional).
-- --
function self:addNode( id, x, y, anchor ) function self:addNode( id, x, y, anchor, ... )
print( id, x, y, anchor, parent, path, spritebatch )
assert( not nodes[id], "Node IDs must be unique." ); assert( not nodes[id], "Node IDs must be unique." );
nodes[id] = Node.new( id, x, y, anchor ); nodes[id] = Node.new( id, x, y, anchor, ... );
return nodes[id]; return nodes[id];
end end

View File

@ -17,7 +17,7 @@ local DEFAULT_MASS = 0.05;
-- @param y - The y coordinate the Node should be spawned at (optional). -- @param y - The y coordinate the Node should be spawned at (optional).
-- @param anchor - Wether the node should be locked in place or not (optional). -- @param anchor - Wether the node should be locked in place or not (optional).
-- --
function Node.new( id, x, y, anchor ) function Node.new( id, x, y, anchor, ... )
local self = {}; local self = {};
local px, py = x or 0, y or 0; local px, py = x or 0, y or 0;