✓ Accepted answer
No. Tables can store arbitrary objects and functions. Consider this on the server:
local blah = {}
function _G.set(x)
blah = x
end
function _G.get()
return blah
end
I could then do this on a client:
local mine = {}
_G.get().hello = mine
mine.blah = _G.get()
Now blah, which resides in the server's memory, refers to mine, in the client's memory (and vice versa). Managing this is sort of ridiculous and doesn't make any sense. When you say _G.get(), how long do you wait? What if the value has since changed?
You have to properly use RemoteEvent and RemoteFunctions. These give a safe, simple filter that connects the client and the server.
If you really are uncomfortable using them, you can of course do some magic with modulescripts / metatables / whatever you want to take advantage of RemoteFunctions behind-the-scenes.
3 comments
Thank you much!
While it doesn't really make sense, I realized you can totally do this -- I'm writing a module script right now. (I wouldn't recommend it in practice -- it's cleaner and safer to use RemoteFunctions)
Nevermind, this is nightmarish (cyclic tables + functions)