Adding things to tables through chat commands

So if a player were to type


!exempt <SteamID>

I would want to add this


<SteamID> = true

to the table so that it would be the same as typing the following in the config:



Settings.Exempt = {
	['<SteamID>']			= true,
}


I looked on the wiki and found

table.insert but I’m pretty sure that I can’t do this using that.

local table = {}

table[ply:SteamID()] = true

I’m not sure what your saying… I want to add the players SteamID while in-game, so typing the command would result in the following being added to the table without leaving the game: [’<player’s steamid>’] = true

yes

Would this work?



local functionsTable = {}
functionsTable["exempt"] = function( ply, args )
	if IsValid( args[1] ) then
		if plyHasPerms( ply ) then
                        tempTable= {}
			tempTable[args[1]]
                        table.Merge( tempTable, RAS.Settings.Exempt )
			return ''
		else
			RAS.ChatPrint( "You do not have permission to do this!", ply )
			return ''
		end
	else
		RAS.ChatPrint( "Target is invalid!", ply )
		return ''
	end
end

local function CommandFilter( ply, text )
	local args = string.Split( text, " " )
	if args[1] == "!ras" or args[1] == "/ras" then
		local func = functionsTable[args[2]]
		if func then
			table.remove( args, 1 ) -- There's no need to pass on the "ras" part of it, as we only need it here to call the function
			table.remove( args, 1 ) -- There's also no need to pass on the second part of it, as we only need it here to know which function to call exactly
			PrintTable( RAS.Settings )
			func( ply, args ) -- We pass any additional argument for the function to handle
		end
	end
end
hook.Add( "PlayerSay", "CheckForChatRASCommand", CommandFilter )