How can I save arguments in a table

So what I want to do is save arguments in a table to use in a loop for a function. Here is a example:

I have a table of 2D point coordinates:
9db58d9ceba68a412b9fa4a4831aab64
And I want to loop through each point’s coordinates to use in a go-to function like here:
26eb53f380dac9dfafd9685b8be84a84
So if anyone can help me that will be nice! :smiley:

Btw: this obviously won’t work

You misspelled point as points, also you have 2 indexes per location meaning you need to do it a bit differently.

What I’d suggest is putting each coordinate in a separate table:

local Points = {
{32,32}, {32,1}, {1,1}, {1,32}
}

for _, point in pairs(Points) do
  goto(point) -- or: goto(point[1], point[2])
end

If you’re determined on keeping it formatted as it is, you can skip all even indexes and include i and i+1.

1 Like

that does not seem to work because when I tested it on print, it just prints a bunch of bytecode garbage. but I did use it on my goto () function which does take two arguments, nothing happens :confused:

It prints bytecode as that is how tables are saved and stored on ROBLOX’s side of things, if you want it to print proper points, simply:
print(point[1],point[2])

With that being said, I’m not sure why @Legoracer’s solution isn’t compatible with your goto() function, did you make sure to use the goto(point[1],point[2]) example they provided?

I will make a different post going deeper into this :smiley: