Saving Arguments in a Table

Hello! Today I encountered a problem with tables. So I was making a drawing canvas sort of like a screen to Draw with using code or UserInputService. It has a Size of 64x64 bricks. And I already have a Drawing function that takes in two Arguments: X coordinate and a Y coordinate (and yes it works completely fine and draws to that exact point without any issues).

Now it was inefficient to copy and paste the function multiple times for each point, so I wanted to create a table filled with 2D points then loop through each one to draw to the screen. But it was not that simple since I kept getting this error:

Argument 1 missing or nil

which was annoying so I decided to ask you guys! Help will be Awesome! :smiley:

Well, what does your code look like? It’s hard to help you if we don’t know what you pass in as arguments and what the function that takes the arguments does.

table:

local points = {
	{32,32},
	{32,1}, 
	{1,1}, 
	{1,32}
}

looping function:

function render ()
	for _,point in pairs(points) do
		goto (point)
	end
end

And what does your goto function do?

Okay so my function takes in two arguments like said before. So when I use it like this:

goto (15,15)

this will happen:


which is exactly what I want

Never mind I already have a fix

Do you mind posting how you fixed it, so when other people have a similar problem they can see the solution

Do you see it? Goto takes two arguments, number and number, OP gives goto a table.