command that sets variable name?

is there a way I can use a command to set a variable name? i tried


concommand.Add("SetVariableName", function(name)
var...name=10

but it gave me an error. same with var"name"

[lua]concommand.Add(“SetVariableName” , function(pl,cmd,args)
local cmd = table.concat(args," ")
_G[cmd] = 10
end )[/lua]

_G is a reference to Lua’s global environment. Accessing it via the table reference is the only way to create variables with dynamic names.

thank you.