Is this a correct way of writing a table?

Hello, I have a script, but I’m not sure if this is the correct way to write a table.insert. How can I fix this? Thank you.

This is the table:

for i, v in pairs(touchingRightSensor) do
	print(v)
	table.insert(rightSensorTable, v) -- This line is the part that I'm not sure if this is the correct writing.
end

if this is a table then yes, it is correct

1 Like

Thanks, but I’m not sure if putting a v after the rightSensorTable is correct.

That way works as if you put the 2nd arg that it shows there roblox would just give it an orange underline and say you can remove it to be more efficient

1 Like

In this situation, this would be your most powerful resource when getting started with tables in roblox: Tables | Roblox Creator Documentation

The subheader would be “Inserting Items”

But, yes this is correctly formatted for entering v into rightSensorTable at #rightSensorTable+1.

1 Like