If I pass a table as an arg, is it the same table reference?

Hi, if I have a table like

local Table1 = {}

function PassTable(Table, Character)
 Table[Character] = true
end

PassTable(Table1, Character)

In the passTable function, with the table arg will it still use the real actual table that was sent? in this case would it use Table1 that was passed?

passing tables to functions always passes a reference to that table, just like instances.
Unless you pass it through a remote

2 Likes

I don’t think you need to pass in the table here?

As long as the table is defined in the same script and outside the function it should be readable without being passed in. Not sure tho, it’s been a while since I’ve done scripting.

thats true he could just use Table1 instead of passing the same table. Passing the table is only useful when calling functions out of its scope, like module functions, and the table library