Original Question
I want to add say Table = {["Test Command"] = {"tableitem1","tableitem2"}, ["Extra Command"] = {"extra1","extra2"}}
into the commands table, however every time I try to insert it; I get the index value. I know that table.insert()
goes off of index values, so now the question is; how do you insert the test command into the Commands table?
Answer
Alright, my goal was; insert a bracket string table that has other tables inside of the string table, into one big table without using table.insert()
. The reason people have issues inserting a bracket string table into another table (getting a number where the main title, in this case “Table Name”, would be.) is because when you use table.insert()
, you’re only inserting the numbers of the index instead of sending the whole string. That’s why in this instance, if I referenced my original table; if I printed that out, I would of gotten [Index Number] = {"tableitem1","tableitem2"}
or not have gotten anything at all.
The way to send the whole string you need is to as @PerilousPanther said;
How do you do that? Use the coding below this as reference to create/insert your bracket tables where you want them to be;
local TableReference = {}
TableReference["Table Name"] = {
"Everything else you want inside the table",
Function = function()
print("Yes, even functions and other items as well.")
end}
Thank you @PerilousPanther for your assistance in this question.
I had no idea that you could add something into a table by doing what I did above; this will make things a LOT easier for me in the future.
for anyone wondering; the reason I was asking was because I wanted to create a self command creation function for my admin system.