I have noticed that group definitions are within a table, and the group "name" is an index in the table, and the number "level" for that group is stored "at" the index. The index is not a string in any examples I have found. And, when I try to test whether strings are acceptable as the index, an error is thrown: "'}' expected near '='". So, it is not currently possible for groups table indexes to be strings.
I have not found any way to insert group definitions into a table, said table being the groups table passed to the minetest.register_craftitem() function call. The only way I have found to "insert" group definitions is for them to be written out directly into a table, like this:
Code: Select all
groups = {metal = 1, ingot = 1, silver = 1}
...
groups = groups,
...
Code: Select all
a = {metal = 1}
b = {ingot = 1}
c = {silver = 1}
Code: Select all
groups = {metal = 1, ingot = 1, silver = 1}
I have tried everything that I know of, such as table index tricks and table.concat() (which returns a useless string, remember we get that error if the group name is a string and not an unassigned variable)...
Is this even possible? If so, how?
If this is possible, I suggest that information regarding how to do this should be added to the developer wiki page at http://dev.minetest.net/Groups, because that is where I first went to try and find out how to do this, before searching the Lua documentation to no avail.