Hello devs! Why use "shared" and how to set it?

-- Isn't correct

local table1 = {}
shared = table1

3 comments

0

You don't set shared itself, you add to it just like you would with _G. It's just another table shared across all scripts. If you structure your game's code well, you shouldn't need to use either.

0

..i used shared when i need a game state variable though T_T

0

Then you didn't structure your game code well @FIfkee. You should instead have a module with the variables inside. With that, scripts can change it and other scripts will recieve the game.