Basically, for my place, there are a set of command that high ranks in a certain group can use. However, I want to be able to let others have access to these commands by giving them commands in game. The best idea I came up with to do this is to create an empty table and add people's names to the table while I'm in game, so that whenever they speak a certain command, the script registers it. I already got the iteration part done; all I need to know is how to player names to a table. Could someone tell me how I could do this? Thanks.
It's very easy. Lua provides a built in function to add values to tables called table.insert(). It's pretty self explanatory.
1 | table.insert(tableName, value) |
This will place value
at the end of the table, but there's also an optional argument that dictates where the value is added.
1 | table.insert(tableName, 2 , value) --Puts it at table[2]. |