How do you use SharedTable's?

Hello, developer.

SharedTables are used in parallel luau, which I recently learned about.
But I was curious about how and why you would use it. I already found the documentation, but the examples aren’t helping a lot.

According to what I’ve read, it’s used to share state across scripts parented under different Actor instances. Could you give an example of this, please.
A brief explanation is also beneficial!

Have a good day and thanks for your time!

Online documentation

They are what their names suggests: “Shared Tables.” You can transfer information for one actor to another actor using them, when previously you would need hacky workarounds to do so.

You use and access them the same way as a normal table

-- A script under one actor
local t = SharedTable.new()
t.Index = "World"

SharedTableRegistry:SetSharedTable("Test Table", t)

-- A script under another actor
local t = SharedTableRegistry:GetSharedTable("Test Table")
print(t.Index) --> prints "World"
10 Likes

Never knew a SharedTable registry existed! Thank you!

1 Like

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