Hi there.
I have a hierarchy something like this:
----- ReplicatedStorage
--- ModuleScript
----- StarterPlayer
--- StarterPlayerScripts
-- LocalScript
Within the module script, I initialize a table called foo
:
local module = {}
module.foo = {
["bar"] = module.foobar
}
function module.foobar() end
Within my LocalScript
, I access the module:
local RS: ReplicatedStorage = game:GetService("ReplicatedStorage")
local module_script: ModuleScript = require(RS:WaitForChild("ModuleScript"))
print(module_script)
--> {
--> ["foo"] = {},
--> ["foobar"] = function (hex address)
--> }
The issue is that the table foo
declared in the ModuleScript
appears empty when accessed in the LocalScript
, whereas the expected output is:
print(module_script)
--> {
--> ["foo"] = {
--> ["bar"] = function (hex address)
--> },
--> ["foobar"] = function (hex address)
--> }