So I was programming a settings gui and some of the tables (em,Controllers,PopulationCodes) say that it has nothing inside it even though I clearly added functions to the table. I’ve been trying to figure out why since yesterday but it’s making no sense to me.
If anyone could please tell me the mistaking here then that’d be great.
--Module:
local module = {}
local em = {}
local dataStuffs = {}
local function ThemeControl(mode)
dataStuffs.Theme = mode
return "Hi"
end
local function CloudsControl(mode)
dataStuffs.Clouds = mode
return "Konnichiwa"
end
local function ShadowsControl(mode)
dataStuffs.Shadows = mode
return "Hola"
end
warn(ThemeControl("Black Magic"),CloudsControl("On"),ShadowsControl("On")) --Hi,Konnichiwa,Hola
local Controllers = {Theme = ThemeControl,Clouds = CloudsControl,Shadows = ShadowsControl}
warn(Controllers,#Controllers,"Controllers") --table,0,Controllers
local PopulationCodes = {["Clouds"] = {"On","Off"},["Shadows"] = {"On","Off"}}
warn(PopulationCodes,#PopulationCodes,"PopulationCodes") --table,0,PopulationCodes
function module.Init(funcs)
em = funcs -- Functions for RemoteEvent (There is not 0 functions in this table)
warn(#em,"em") --0,em
local TempTable = {"hi","reee",function() warn("hi") end}
warn(TempTable,"TempTable",#TempTable) --table,TempTable,3
local ThemeData = {}
PopulationCodes["Theme"] = ThemeData
warn(PopulationCodes,"PopulationCodes",#PopulationCodes) --table,PopulationCodes,0
function em.RecieveFrameData(theme,clouds,shadows)
warn(theme,clouds,shadows,"RecieveFrameData")--Black Magic,On,On,RecieveSettingsFrameData
dataStuffs = {{Name = "Theme",Value = theme},{Name = "Clouds",Value = clouds},{Name = "Shadows",Value = shadows}}
warn(dataStuffs,"dataStuffs",#dataStuffs) --table,dataStuffs,3
if not dataStuffs then return end
local lOrder = 0
for _,v in ipairs(dataStuffs) do
lOrder = lOrder + 1
warn(v.Name,lOrder)
end
end
em.RecieveFrameData("Black Magic","On","On")--Placeholder for Event:FireServer() (Since it will get a players settings datastore)
end
return module
--Client:
local em = {}
function em.func() -- just to make there be 1 thing inside the em inside of 0
warn("temp")
end
local module = require(script.ModuleScript)
module.Init(em)
Output looks like this