What do you want to achieve? Keep it simple and clear!
I’m trying to make a simple admin command handler
What is the issue? Include screenshots / videos if possible!
It won’t work, I’ve tried just about everything but it just doesn’t send anything into the table
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I looked everywhere but can’t find any answers. I’ve tried different methods of inserting dictionaries into a table and it still won’t work.
local func = {}
local function create(...)
func[#func+1] = {...}
end
create({
["Name"] = "test",
["Aliases"] = {"none"},
["Function"] = function()
print("Test functional!")
end
})
print(unpack(func))
local functions = func[1]["Function"]
functions() -- Attempt to call a nil value
Here is where it goes wrong. You are giving 1 parameter to the function, which is a dictionary.
Right now, your table “func” looks like this: {} and will now become:
{
{
{
["Name"] = ...(etc)
}
}
}
so to now call the function you want, you’d have to do:
local functions = func[1][1]["Function"]
or
funct[#func+1] = (...)
Then it would work.
tl;dr it doesn’t work because you forgot there’s another array you need to go through before going to the function you want to reference