> also, one quick question—what is a table?
It is a Lua value (an object) that offers key-value mapping and
associative arrays (a list, but ignore this for now).
What you call a group is actually a TABLE.
Here is a table:
> local t = { a = 5 }
Table definition begins with '{' and ends with corresponding '}',
anything inside of those braces are table elements.
The above table has a single key-value mapping (a single element),
the string "a" mapped to (or assigned) the integer VALUE 5.
This table VALUE is assigned to the (local) VARIABLE 't'.
So the following two lines:
> print(t.a)
> print(t["a"])
will print (the '> ' prefix is how I highlight code/output in email):
> 5
> 5
Now you can also do:
> local t = { "MyName" }
this is equivalent to:
> local t = { [1] = "MyName" }
where the integer VALUE 1 is mapped to the string VALUE "MyName".
(This table VALUE is once again assigned to the local VARIABLE 't'.)
So this:
> print(t[1])
will print the following string VALUE
> MyName
You will notice that you need to use index notation ('[' ']') as
opposed to dot access ('.') for non-string key values or strings
that do not form a valid name/identifier.
In other words the 't.bla' is syntax sugar for 't["bla"]'.
Finally, the 'local' keyword is put before the VARIABLE name,
it means the VARIABLE is only visible to the current
script/function/block/chunk
where this VARIABLE is declared.
If you want to access a VARIABLE (such as 't') outside of that
script/function/block/chunk (perhaps from a different script/file that
requires
or executes after that script) then you can omit 'local' from the
examples above
> t = { [1] = "MyName" }
The above is global VARIABLE named 't',
assigned the VALUE of a table that has a single
element (key-value pair). The key is the integer
VALUE 1 that is mapped to string VALUE "MyName".
Of course, the following would be equivalent to the above
> t = { "MyName" }
and
> t = { "MyName", "OtherName" }
is actually
> t = { [1] = "MyName", [2] = "OtherName" }
I don't know if you knew these things already but I just couldn't understand
your email well enough (confusing terminology).
Hopefully it helps a bit to solve your problem, check out Lua reference
manual
(do 'print(__VERSION)' to see which version of reference manual to use).
I suggest learning Lua a bit and learning to separate what is part of
core/standard
Lua and the platform (Fandom) that embeds (or uses in some way?) Lua.
(Keep in mind, the above terminology I used is not so precise, just a
few beginner
friendly lines of code/explanations.)
-- Jure