I was trying to figure out how to pass functions from the server to the client using remote events and somebody told me I could use configuration dictionaries (Can you pass a function as a tuple argument when you fire a remote event from the server to the client? - #2 by RuizuKun_Dev). What is a configuration dictionary?
I am not sure but I guess it’s a dictionary (array) with configurations based on an objec, that you can pass through a remote event.
How would I create one? ( character limit )
I’m not sure but this may help?
local table = {"number1","string2"}
?
I tried that but thanks for your help anyway.
A dictionary is a type of array that contains keys and values.
Examples:
local John = {
["Species"] = "Homo Sapien",
["Age"] = 22,
["Occupation"] = "Software Engineer",
["Other Stuff"] = false;
}
The objects encased in []
are called ‘Keys’. The items on the right are their values.
You can access the values using the keys:
print(John.Occupation) -- prints Software Engineer
print(John["Occupation"]) -- prints Software Engineer
The above do the same thing.
I solved the issue by, well, not sending the function and storing it in the local script. I already know what tables and dictionaries are but either way thank you for your reply.
Ik that this is stupid questions . BUT what are the difrence between table and arrays??
Both terms refer to the same type of object.
An array in Lua is a table, except it’s just a list with the kegs starting on 1 and each new value is +1 the highest index.
Example:
{
4,
5,
6
}
==
{
[1] = 4,
[2] = 5,
[3] = 6
}
So an array is something with key and value and table us just a value… is it??
All tables and arrays in Lua have a key and a value,
In Lua arrays are just a list which starts with the index number 1.
(key == index btw)
Owhhhhhhh I think I get it.Thanks