Dismantling table into table[1]. table[2] and putting it in a function

Hello,

I have a table of a folders children, which are nodes.
local nodestable = game.Workspace.Nodes:GetChildren()

I have a function that uses this in this form:

local NewBezier = Bezier.new(nodestable[1], nodestable[2], nodestable[3],nodestable[4],nodestable[5],nodestable[6],nodestable[7],nodestable[8],nodestable[9],nodestable[10],nodestable[11],nodestable[12],nodestable[13],nodestable[14],nodestable[15])

The problem is that it only goes up to 15… but I dont know how many nodes are in the nodestable, because new ones get added and deleted.

How would i get the number of nodes in the nodestable and somehow put it in the parameters as [1]. [2]. [3]

1 Like

Try this: local NewBezier = Bezier.new(unpack(nodestable))

Though it depends on how Bezier.new() is defined, as it needs to accept a variable number of arguments. Does the method look like: function Bezier.new(...) ?

1 Like

Yes it does.

And it worked, thank you!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.